Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Fri, 25 Jun 2010 18:45:27 +0000 (11:45 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Jun 2010 18:45:27 +0000 (11:45 -0700)
* maint:
msvc: Fix some compiler warnings
Documentation: grep: fix asciidoc problem with --
msvc: Fix some "expr evaluates to function" compiler warnings

1  2 
builtin.h
builtin/notes.c
notes.h
diff --combined builtin.h
index b614d12b9f3464eff9ecfa90c2eb5ecf43a82b7e,fdae0279ef3e4ba4d6b03f651d19e772a239ddc0..1054c6e2950c3bc433841683ca4fcf7ce6501df3
+++ 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 648033c27e75e9a19e9fd3a2fa21b2e26b19d5ac,da504ee0af5dab303add0ddf210a7953ca87ae9d..f1f53a80e188327c0da21b046f0e8879caabc6af
@@@ -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
  };
  
@@@ -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()
        };
  
  
        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 cc2dff22a12f2f7e78d37fb316e70f0a1ebaa2cd,109bc8f78236d8067568e524ffaf4ae21ee6c027..65fc3a66b2f575dd078cc390e7f5ea5cbebffc96
+++ 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
   *
   * 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