Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 29 Jun 2010 00:42:26 +0000 (17:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jun 2010 00:42:26 +0000 (17:42 -0700)
* maint:
Update draft release notes to 1.7.1.1
notes: Initialise variable to appease gcc
notes: check number of parameters to "git notes copy"

1  2 
builtin/notes.c
notes.c
diff --combined builtin/notes.c
index f1f53a80e188327c0da21b046f0e8879caabc6af,f678f9cb520fa331de4899e372502cffccd9682c..190005f3cd44a35a6fffb20b1e4c74622b4d93f7
@@@ -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
  };
  
@@@ -614,6 -614,10 +614,10 @@@ static int copy(int argc, const char **
                }
        }
  
+       if (argc < 2) {
+               error("too few parameters");
+               usage_with_options(git_notes_copy_usage, options);
+       }
        if (2 < argc) {
                error("too many parameters");
                usage_with_options(git_notes_copy_usage, options);
@@@ -792,10 -796,7 +796,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;
  }
diff --combined notes.c
index 6ee04e79e903901db3594feae69ceca4374994e2,cc92cf351a5d8abb7ad2890660d484644c359dfb..30d6ded78ef61cceeec9d0d0377e6622d6abd5f6
+++ b/notes.c
@@@ -716,7 -716,7 +716,7 @@@ static int write_each_non_note_until(co
                struct write_each_note_data *d)
  {
        struct non_note *n = d->next_non_note;
-       int cmp, ret;
+       int cmp = 0, ret;
        while (n && (!note_path || (cmp = strcmp(n->path, note_path)) <= 0)) {
                if (note_path && cmp == 0)
                        ; /* do nothing, prefer note to non-note */
@@@ -1083,7 -1083,7 +1083,7 @@@ int write_notes_tree(struct notes_tree 
        return ret;
  }
  
 -void prune_notes(struct notes_tree *t)
 +void prune_notes(struct notes_tree *t, int flags)
  {
        struct note_delete_list *l = NULL;
  
        for_each_note(t, 0, prune_notes_helper, &l);
  
        while (l) {
 -              remove_note(t, l->sha1);
 +              if (flags & NOTES_PRUNE_VERBOSE)
 +                      printf("%s\n", sha1_to_hex(l->sha1));
 +              if (!(flags & NOTES_PRUNE_DRYRUN))
 +                      remove_note(t, l->sha1);
                l = l->next;
        }
  }