implement 'raw' links from tree
authorChristian Thaeter <ct@pipapo.org>
Wed, 16 Jan 2008 14:55:27 +0000 (15:55 +0100)
committerChristian Thaeter <ct@pipapo.org>
Wed, 16 Jan 2008 14:55:27 +0000 (15:55 +0100)
src/actions.c
src/branch.c
src/log.c
src/object.c
src/object.h

index ebc9dac..f766ff6 100644 (file)
@@ -90,6 +90,7 @@ webgit_main_content_action (struct webgit_query* query)
                                                               n->name, strlen(n->name),
                                                               n->last_commit, 40,
                                                               NULL,
+                                                              NULL,
                                                               webgit_pretty_age (n->age))
                                           ),
                                      html(html_tag ("td"),
@@ -122,6 +123,7 @@ webgit_main_content_action (struct webgit_query* query)
                                                                    n->name, strlen(n->name),
                                                                    n->last_tree, 40,
                                                                    NULL,
+                                                                   NULL,
                                                                    html("Tree"))
                                                )
                                           )
@@ -190,6 +192,7 @@ webgit_summary_content_action (struct webgit_repo_info* repo)
                                                    repo->name, strlen(repo->name),
                                                    repo->last_commit, 40,
                                                    NULL,
+                                                   NULL,
                                                    webgit_pretty_age (repo->age)),
                                " in branch ",
                                 webgit_log_link (repo->query,
index c6c3dd4..a10301d 100644 (file)
@@ -112,6 +112,7 @@ show_branch_ref (const char *refname, const unsigned char *sha1, int flags, void
                                                     repo->name, strlen(repo->name),
                                                     sha1_to_hex (sha1), 40,
                                                     NULL,
+                                                    NULL,
                                                     webgit_pretty_age (repo->query->now - date))
                                 ),
                           html (
@@ -127,6 +128,7 @@ show_branch_ref (const char *refname, const unsigned char *sha1, int flags, void
                                                     repo->name, strlen(repo->name),
                                                     webgit_commit_tree_parse (commit), 40,
                                                     NULL,
+                                                    NULL,
                                                     html ("Tree")
                                                     ),
                                 html (" Snapshot")
index 2a49653..e2b4c64 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -127,6 +127,7 @@ webgit_log_table (struct webgit_query* query, const char* object, int count, int
                                                              sha1_to_hex (commit->object.sha1),
                                                              40,
                                                              NULL,
+                                                             NULL,
                                                              webgit_commit_header_parse (commit)
                                                              )
                                          )
@@ -149,6 +150,7 @@ webgit_log_table (struct webgit_query* query, const char* object, int count, int
                                                                   webgit_commit_tree_parse (commit),
                                                                   40,
                                                                   NULL,
+                                                                  NULL,
                                                                   html ("Tree")
                                                                   )
                                               )
index c8943ce..57e9b93 100644 (file)
 
 Html
 webgit_object_link (struct webgit_query* query,
-                   const char* repo,
-                   int repo_len,
-                   const char* object,
-                   int object_len,
-                   const char* path,
-                   Html text)
+                    const char* repo,
+                    int repo_len,
+                    const char* object,
+                    int object_len,
+                    const char* path,
+                    const char* action,
+                    Html text)
 {
   return html (
                html_tag ("a",
@@ -39,7 +40,8 @@ webgit_object_link (struct webgit_query* query,
                                                             query->request->script_name,
                                                             repo_len, repo,
                                                             object_len, object),
-                                                  path ? html_fmt ("&path=%s", path) : html ()
+                                                  path ? html_fmt ("&path=%s", path) : html (),
+                                                  action ? html_fmt ("&action=%s", action) : html ()
                                                   )
                                     )
                          ),
@@ -250,6 +252,7 @@ webgit_object_commit_content_action (struct webgit_query* query, unsigned char*
                                                 query->repo, strlen (query->repo),
                                                 i+5, 40,
                                                 NULL,
+                                                NULL,
                                                 html_fmt ("%.40s", i+5))
                             );
           if ((i = strchr (i, '\n')))
@@ -264,6 +267,7 @@ webgit_object_commit_content_action (struct webgit_query* query, unsigned char*
                                                                query->repo, strlen (query->repo),
                                                                i+7, 40,
                                                                NULL,
+                                                               NULL,
                                                                html_fmt ("%.40s", i+7))
                                            )
                             );
@@ -469,6 +473,7 @@ webgit_html_tree (const unsigned char *sha1, const char *base, int baselen,
                                                                               strlen (query_in_flight->repo),
                                                                               sha1_to_hex (sha1), 40,
                                                                               pathname,
+                                                                              NULL,
                                                                               html_strndup (name, SIZE_MAX))
                                                           ),
                                                   html (html_tag ("td"), "history snap")
@@ -488,9 +493,19 @@ webgit_html_tree (const unsigned char *sha1, const char *base, int baselen,
                                                                               strlen (query_in_flight->repo),
                                                                               sha1_to_hex (sha1), 40,
                                                                               pathname,
+                                                                              NULL,
                                                                               html_strndup (name, SIZE_MAX))
                                                           ),
-                                                    html (html_tag ("td"), "history raw edit")
+                                                    html (html_tag ("td"),
+                                                          "history ",
+                                                          webgit_object_link (query_in_flight,
+                                                                              query_in_flight->repo,
+                                                                              strlen (query_in_flight->repo),
+                                                                              sha1_to_hex (sha1), 40,
+                                                                              pathname,
+                                                                              "raw",
+                                                                              html ("raw")),
+                                                          " edit")
                                                     ),
                                               html_nl()
                                               )
index c18a4fb..f1df9d9 100644 (file)
@@ -35,6 +35,7 @@ webgit_object_link (struct webgit_query* query,
                    const char* object,
                    int object_len,
                    const char* path,
+                   const char* action,
                    Html text);
 
 char*