X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin%2Fnotes.c;h=190005f3cd44a35a6fffb20b1e4c74622b4d93f7;hb=ad9ac6db5d58de08d0497b9184e86926377c20dd;hp=f678f9cb520fa331de4899e372502cffccd9682c;hpb=878bd809d7c879f1a9ea00bdb4cb97d846ef4e93;p=git.git diff --git a/builtin/notes.c b/builtin/notes.c index f678f9cb5..190005f3c 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -26,7 +26,7 @@ static const char * const git_notes_usage[] = { "git notes [--ref ] edit []", "git notes [--ref ] show []", "git notes [--ref ] remove []", - "git notes [--ref ] prune", + "git notes [--ref ] prune [-n | -v]", NULL }; @@ -67,7 +67,7 @@ static const char * const git_notes_remove_usage[] = { }; static const char * const git_notes_prune_usage[] = { - "git notes prune", + "git notes prune []", NULL }; @@ -796,7 +796,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) 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() }; @@ -810,8 +813,10 @@ static int prune(int argc, const char **argv, const char *prefix) 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; }