rev-parse --glob
Add --glob=<glob-pattern> option to rev-parse and everything that accepts its options. This option matches all refs that match given shell glob pattern (complete with some DWIM logic). Example: 'git log --branches --not --glob=remotes/origin' To show what you have that origin doesn't. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
5b15950ac4
commit
d08bae7e22
16
revision.c
16
revision.c
@ -699,12 +699,18 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
|
||||
unsigned flags)
|
||||
{
|
||||
cb->all_revs = revs;
|
||||
cb->all_flags = flags;
|
||||
}
|
||||
|
||||
static void handle_refs(struct rev_info *revs, unsigned flags,
|
||||
int (*for_each)(each_ref_fn, void *))
|
||||
{
|
||||
struct all_refs_cb cb;
|
||||
cb.all_revs = revs;
|
||||
cb.all_flags = flags;
|
||||
init_all_refs_cb(&cb, revs, flags);
|
||||
for_each(handle_one_ref, &cb);
|
||||
}
|
||||
|
||||
@ -1352,6 +1358,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
||||
handle_refs(revs, flags, for_each_remote_ref);
|
||||
continue;
|
||||
}
|
||||
if (!prefixcmp(arg, "--glob=")) {
|
||||
struct all_refs_cb cb;
|
||||
init_all_refs_cb(&cb, revs, flags);
|
||||
for_each_glob_ref(handle_one_ref, arg + 7, &cb);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--reflog")) {
|
||||
handle_reflog(revs, flags);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user