summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2010-05-14 21:42:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-05-20 06:57:18 (GMT)
commita9f2adff802308481f2e638bae0c5b6e205251a3 (patch)
treed07556227fcb7ff083ab7032751b247052c6a9d2 /notes.c
parent0e4607c09d72ada4942ea49298dba83ec4145892 (diff)
downloadgit-a9f2adff802308481f2e638bae0c5b6e205251a3.zip
git-a9f2adff802308481f2e638bae0c5b6e205251a3.tar.gz
git-a9f2adff802308481f2e638bae0c5b6e205251a3.tar.bz2
notes: dry-run and verbose options for prune
Introduce -n and -v options for "git notes prune" in complete analogy to "git prune" so that one can check for dangling notes easily. The output is a list of names of objects whose notes would be resp. are removed so that one can check the object ("git show sha1") as well as the note ("git notes show sha1"). Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/notes.c b/notes.c
index e425e19..6ee04e7 100644
--- a/notes.c
+++ b/notes.c
@@ -1083,7 +1083,7 @@ int write_notes_tree(struct notes_tree *t, unsigned char *result)
return ret;
}
-void prune_notes(struct notes_tree *t)
+void prune_notes(struct notes_tree *t, int flags)
{
struct note_delete_list *l = NULL;
@@ -1094,7 +1094,10 @@ void prune_notes(struct notes_tree *t)
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;
}
}