OSDN Git Service

Merge branch 'kn/for-each-tag-branch'
authorJunio C Hamano <gitster@pobox.com>
Mon, 5 Oct 2015 19:30:02 +0000 (12:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Oct 2015 19:30:03 +0000 (12:30 -0700)
Some features from "git tag -l" and "git branch -l" have been made
available to "git for-each-ref" so that eventually the unified
implementation can be shared across all three, in a follow-up
series or two.

* kn/for-each-tag-branch:
  for-each-ref: add '--contains' option
  ref-filter: implement '--contains' option
  parse-options.h: add macros for '--contains' option
  parse-option: rename parse_opt_with_commit()
  for-each-ref: add '--merged' and '--no-merged' options
  ref-filter: implement '--merged' and '--no-merged' options
  ref-filter: add parse_opt_merge_filter()
  for-each-ref: add '--points-at' option
  ref-filter: implement '--points-at' option
  tag: libify parse_opt_points_at()
  t6302: for-each-ref tests for ref-filter APIs

1  2 
builtin/branch.c
builtin/tag.c
parse-options-cb.c
parse-options.h
ref-filter.c

Simple merge
diff --cc builtin/tag.c
Simple merge
@@@ -4,7 -4,7 +4,8 @@@
  #include "commit.h"
  #include "color.h"
  #include "string-list.h"
 +#include "argv-array.h"
+ #include "sha1-array.h"
  
  /*----- some often used options -----*/
  
diff --cc parse-options.h
@@@ -247,9 -243,12 +248,16 @@@ extern int parse_opt_passthru_argv(cons
        OPT_COLOR_FLAG(0, "color", (var), (h))
  #define OPT_COLUMN(s, l, v, h) \
        { OPTION_CALLBACK, (s), (l), (v), N_("style"), (h), PARSE_OPT_OPTARG, parseopt_column_callback }
 +#define OPT_PASSTHRU(s, l, v, a, h, f) \
 +      { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru }
 +#define OPT_PASSTHRU_ARGV(s, l, v, a, h, f) \
 +      { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru_argv }
+ #define _OPT_CONTAINS_OR_WITH(name, variable, help, flag) \
+       { OPTION_CALLBACK, 0, name, (variable), N_("commit"), (help), \
+         PARSE_OPT_LASTARG_DEFAULT | flag, \
+         parse_opt_commits, (intptr_t) "HEAD" \
+       }
+ #define OPT_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("contains", v, h, 0)
+ #define OPT_WITH(v, h) _OPT_CONTAINS_OR_WITH("with", v, h, PARSE_OPT_HIDDEN)
  
  #endif
diff --cc ref-filter.c
Simple merge