From: Junio C Hamano Date: Fri, 25 Jun 2010 18:45:27 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.7.2-rc0~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f526d120f649ec4426b559e94e09655b5a4f2b87?ds=inline;hp=-c Merge branch 'maint' * maint: msvc: Fix some compiler warnings Documentation: grep: fix asciidoc problem with -- msvc: Fix some "expr evaluates to function" compiler warnings --- f526d120f649ec4426b559e94e09655b5a4f2b87 diff --combined builtin.h index b614d12b9f,fdae0279ef..1054c6e295 --- a/builtin.h +++ b/builtin.h @@@ -17,19 -17,22 +17,19 @@@ extern void prune_packed_objects(int) extern int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out); extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out); -extern int commit_tree(const char *msg, unsigned char *tree, - struct commit_list *parents, unsigned char *ret, - const char *author); extern int commit_notes(struct notes_tree *t, const char *msg); struct notes_rewrite_cfg { struct notes_tree **trees; const char *cmd; int enabled; - combine_notes_fn *combine; + combine_notes_fn combine; struct string_list *refs; int refs_from_env; int mode_from_env; }; - combine_notes_fn *parse_combine_notes_fn(const char *v); + combine_notes_fn parse_combine_notes_fn(const char *v); struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd); int copy_note_for_rewrite(struct notes_rewrite_cfg *c, const unsigned char *from_obj, const unsigned char *to_obj); diff --combined builtin/notes.c index 648033c27e,da504ee0af..f1f53a80e1 --- a/builtin/notes.c +++ b/builtin/notes.c @@@ -26,7 -26,7 +26,7 @@@ static const char * const git_notes_usa "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 +67,7 @@@ static const char * const git_notes_rem }; static const char * const git_notes_prune_usage[] = { - "git notes prune", + "git notes prune []", NULL }; @@@ -313,7 -313,7 +313,7 @@@ int commit_notes(struct notes_tree *t, return 0; } - combine_notes_fn *parse_combine_notes_fn(const char *v) + combine_notes_fn parse_combine_notes_fn(const char *v) { if (!strcasecmp(v, "overwrite")) return combine_notes_overwrite; @@@ -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() }; @@@ -809,10 -806,8 +809,10 @@@ 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.h index cc2dff22a1,109bc8f782..65fc3a66b2 --- a/notes.h +++ b/notes.h @@@ -18,7 -18,7 +18,7 @@@ * combine_notes_concatenate(), which appends the contents of the new note to * the contents of the existing note. */ - typedef int combine_notes_fn(unsigned char *cur_sha1, const unsigned char *new_sha1); + typedef int (*combine_notes_fn)(unsigned char *cur_sha1, const unsigned char *new_sha1); /* Common notes combinators */ int combine_notes_concatenate(unsigned char *cur_sha1, const unsigned char *new_sha1); @@@ -38,7 -38,7 +38,7 @@@ extern struct notes_tree struct int_node *root; struct non_note *first_non_note, *prev_non_note; char *ref; - combine_notes_fn *combine_notes; + combine_notes_fn combine_notes; int initialized; int dirty; } default_notes_tree; @@@ -171,9 -171,6 +171,9 @@@ int for_each_note(struct notes_tree *t */ int write_notes_tree(struct notes_tree *t, unsigned char *result); +/* Flags controlling the operation of prune */ +#define NOTES_PRUNE_VERBOSE 1 +#define NOTES_PRUNE_DRYRUN 2 /* * Remove all notes annotating non-existing objects from the given notes tree * @@@ -184,7 -181,7 +184,7 @@@ * structure are not persistent until a subsequent call to write_notes_tree() * returns zero. */ -void prune_notes(struct notes_tree *t); +void prune_notes(struct notes_tree *t, int flags); /* * Free (and de-initialize) the given notes_tree structure