summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-02-23 12:05:18 -0800
committerJunio C Hamano <gitster@pobox.com>2010-02-23 12:05:18 -0800
commit80eac928ae11d4e417feddcc6a1ec373cf41e14f (patch)
treedcd3c45289ecc0f3788eac42ff065bfc466fa080 /revision.c
parente73bbd96c6e9ce11a101dac03402d0f718a1bd23 (diff)
parente2b53e58081e6a30309625fc6194ccb42772846b (diff)
downloadgit-80eac928ae11d4e417feddcc6a1ec373cf41e14f.tar.gz
Merge branch 'il/rev-glob'
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index f3b82d97bc..1d3457cb6a 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);
}
@@ -1361,6 +1367,30 @@ 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 (!prefixcmp(arg, "--branches=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
+ continue;
+ }
+ if (!prefixcmp(arg, "--tags=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
+ continue;
+ }
+ if (!prefixcmp(arg, "--remotes=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
+ continue;
+ }
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;