Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-20 12:48:25 +0300
committerJunio C Hamano <gitster@pobox.com>2010-01-20 23:29:05 +0300
commitd08bae7e221727e26baab984b792854b842130d7 (patch)
tree234dd292750f4d1a4c9d200e3b6e2792baa98ae9 /revision.c
parent5b15950ac414a8a2d4f5eb480712abcc9fe176d2 (diff)
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 25fa14d93e..162b182914 100644
--- a/revision.c
+++ b/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;