Merge 'maint' updates in
authorJunio C Hamano <gitster@pobox.com>
Thu, 17 Jun 2010 00:09:20 +0000 (17:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jun 2010 00:09:31 +0000 (17:09 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1  2 
builtin/notes.c
diff --combined builtin/notes.c
index ba8fd178c8d188095e944c6a030d807d2b9f8312,26617546c8cadac493f06473d02f27f320713b28..648033c27e75e9a19e9fd3a2fa21b2e26b19d5ac
@@@ -26,7 -26,7 +26,7 @@@ static const char * const git_notes_usa
        "git notes [--ref <notes_ref>] edit [<object>]",
        "git notes [--ref <notes_ref>] show [<object>]",
        "git notes [--ref <notes_ref>] remove [<object>]",
 -      "git notes [--ref <notes_ref>] prune",
 +      "git notes [--ref <notes_ref>] prune [-n | -v]",
        NULL
  };
  
@@@ -67,7 -67,7 +67,7 @@@ static const char * const git_notes_rem
  };
  
  static const char * const git_notes_prune_usage[] = {
 -      "git notes prune",
 +      "git notes prune [<options>]",
        NULL
  };
  
@@@ -416,7 -416,7 +416,7 @@@ int notes_copy_from_stdin(int force, co
  {
        struct strbuf buf = STRBUF_INIT;
        struct notes_rewrite_cfg *c = NULL;
-       struct notes_tree *t;
+       struct notes_tree *t = NULL;
        int ret = 0;
  
        if (rewrite_cmd) {
@@@ -792,10 -792,7 +792,10 @@@ static int remove_cmd(int argc, const c
  static int prune(int argc, const char **argv, const char *prefix)
  {
        struct notes_tree *t;
 +      int show_only = 0, verbose = 0;
        struct option options[] = {
 +              OPT_BOOLEAN('n', NULL, &show_only, "do not remove, show only"),
 +              OPT_BOOLEAN('v', NULL, &verbose, "report pruned notes"),
                OPT_END()
        };
  
  
        t = init_notes_check("prune");
  
 -      prune_notes(t);
 -      commit_notes(t, "Notes removed by 'git notes prune'");
 +      prune_notes(t, (verbose ? NOTES_PRUNE_VERBOSE : 0) |
 +              (show_only ? NOTES_PRUNE_VERBOSE|NOTES_PRUNE_DRYRUN : 0) );
 +      if (!show_only)
 +              commit_notes(t, "Notes removed by 'git notes prune'");
        free_notes(t);
        return 0;
  }