summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2010-07-07 15:39:12 +0200
committerJunio C Hamano <gitster@pobox.com>2010-07-07 09:48:33 -0700
commit9ef6aeb09ffe0650ca86dca53de93fd85333b02d (patch)
treec3450951b7d3eb0d0bee8ff77229a98255bb4d34 /refs.c
parent0bad611b1ebacf170976a10690bd0169f8d372bf (diff)
downloadgit-9ef6aeb09ffe0650ca86dca53de93fd85333b02d.tar.gz
setup_revisions(): Allow walking history in a submodule
By passing the path to a submodule in opt->submodule, the function can be used to walk history in the named submodule repository, instead of the toplevel repository. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index c8649b1308..37e2794685 100644
--- a/refs.c
+++ b/refs.c
@@ -721,31 +721,62 @@ int head_ref(each_ref_fn fn, void *cb_data)
return do_head_ref(NULL, fn, cb_data);
}
+int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+ return do_head_ref(submodule, fn, cb_data);
+}
+
int for_each_ref(each_ref_fn fn, void *cb_data)
{
return do_for_each_ref(NULL, "refs/", fn, 0, 0, cb_data);
}
+int for_each_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+ return do_for_each_ref(submodule, "refs/", fn, 0, 0, cb_data);
+}
+
int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)
{
return do_for_each_ref(NULL, prefix, fn, strlen(prefix), 0, cb_data);
}
+int for_each_ref_in_submodule(const char *submodule, const char *prefix,
+ each_ref_fn fn, void *cb_data)
+{
+ return do_for_each_ref(submodule, prefix, fn, strlen(prefix), 0, cb_data);
+}
+
int for_each_tag_ref(each_ref_fn fn, void *cb_data)
{
return for_each_ref_in("refs/tags/", fn, cb_data);
}
+int for_each_tag_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+ return for_each_ref_in_submodule(submodule, "refs/tags/", fn, cb_data);
+}
+
int for_each_branch_ref(each_ref_fn fn, void *cb_data)
{
return for_each_ref_in("refs/heads/", fn, cb_data);
}
+int for_each_branch_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+ return for_each_ref_in_submodule(submodule, "refs/heads/", fn, cb_data);
+}
+
int for_each_remote_ref(each_ref_fn fn, void *cb_data)
{
return for_each_ref_in("refs/remotes/", fn, cb_data);
}
+int for_each_remote_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+ return for_each_ref_in_submodule(submodule, "refs/remotes/", fn, cb_data);
+}
+
int for_each_replace_ref(each_ref_fn fn, void *cb_data)
{
return do_for_each_ref(NULL, "refs/replace/", fn, 13, 0, cb_data);