add verbosity level instead just a flag for displaying logs
authorChristian Thaeter <ct@pipapo.org>
Thu, 24 Jan 2008 23:04:47 +0000 (00:04 +0100)
committerChristian Thaeter <ct@pipapo.org>
Thu, 24 Jan 2008 23:04:47 +0000 (00:04 +0100)
0 == just date:topic
1 == plus author and short links
2 == plus message body

src/log.c

index 3d18ac1..c4388a9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -66,7 +66,7 @@ webgit_log_menu_action (struct webgit_query* query)
 
 
 Html
-webgit_log_table (struct webgit_query* query, const char* object, int count, int msg_flag)
+webgit_log_table (struct webgit_query* query, const char* object, int count, int verbosity)
 {
   struct rev_info rev;
   const char* argv[] = {NULL, object, NULL};
@@ -118,55 +118,57 @@ webgit_log_table (struct webgit_query* query, const char* object, int count, int
 
       html_list_append (table,
                         html (
-                              html (
-                                    html_tag ("tr",
-                                              html_attr ("class", (row & 1) ? "odd" : "even")
-                                              ),
-                                    html(html_tag ("td"),
-                                         html_strndup (pretty_date, 254)
-                                         ),
-                                    html(html_tag ("td"),
-                                         webgit_object_link (query,
-                                                             query->repo,
-                                                             strlen (query->repo),
-                                                             sha1_to_hex (commit->object.sha1),
-                                                             40,
-                                                             NULL,
-                                                             NULL,
-                                                             webgit_object_commit_header_parse (commit)
-                                                             )
-                                         )
-                                    ),
-                              html (
-                                    html_tag ("tr",
-                                              html_attr ("class", (row & 1) ? "odd" : "even")
-                                              ),
-                                    html(html_tag ("td"),
-                                         webgit_email_link (
-                                                            webgit_object_commit_author_name_parse (commit),
-                                                            webgit_object_commit_author_email_parse (commit)
-                                                            )
-                                         ),
-                                    html (html_tag ("td"),
-                                         html(
-                                              "Diff ",
-                                              " ",
-                                              webgit_object_link (query,
-                                                                  query->repo,
-                                                                  strlen (query->repo),
-                                                                  webgit_object_commit_tree_parse (commit),
-                                                                  40,
-                                                                  NULL,
-                                                                  NULL,
-                                                                  html ("Tree")
-                                                                  )
-                                              )
-                                          )
-                                    )
+                              html_tag ("tr",
+                                        html_attr ("class", (row & 1) ? "odd" : "even")
+                                        ),
+                              html(html_tag ("td"),
+                                   html_strndup (pretty_date, 254)
+                                   ),
+                              html(html_tag ("td"),
+                                   webgit_object_link (query,
+                                                       query->repo,
+                                                       strlen (query->repo),
+                                                       sha1_to_hex (commit->object.sha1),
+                                                       40,
+                                                       NULL,
+                                                       NULL,
+                                                       webgit_object_commit_header_parse (commit)
+                                                       )
+                                   )
                               )
                         );
 
-      if (msg_flag)
+      if (verbosity > 0)
+        html_list_append (table,
+                          html (
+                                html_tag ("tr",
+                                          html_attr ("class", (row & 1) ? "odd" : "even")
+                                          ),
+                                html(html_tag ("td"),
+                                     webgit_email_link (
+                                                        webgit_object_commit_author_name_parse (commit),
+                                                        webgit_object_commit_author_email_parse (commit)
+                                                        )
+                                     ),
+                                html (html_tag ("td"),
+                                      html(
+                                           "Diff ",
+                                           " ",
+                                           webgit_object_link (query,
+                                                               query->repo,
+                                                               strlen (query->repo),
+                                                               webgit_object_commit_tree_parse (commit),
+                                                               40,
+                                                               NULL,
+                                                               NULL,
+                                                               html ("Tree")
+                                                               )
+                                           )
+                                      )
+                                )
+                          );
+
+      if (verbosity > 1)
         html_list_append (table,
                           html (
                                 html_tag ("tr",
@@ -210,7 +212,7 @@ webgit_log_content_action (struct webgit_query* query)
   else
     object = "HEAD";
 
-  return webgit_log_table (query, object, query->count, 1);
+  return webgit_log_table (query, object, query->count, 2);
 }
 
 /*