summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-04-22 19:52:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-01 22:33:09 (GMT)
commitfcce17039cb94e6490a65a846b2375081785ce9b (patch)
treeadebc4a27d9fc27747f343f62dc2265be1181292 /refs.c
parent6c6f58dfd26c0643e38d7ea754b6d4173573a1f6 (diff)
downloadgit-fcce17039cb94e6490a65a846b2375081785ce9b.zip
git-fcce17039cb94e6490a65a846b2375081785ce9b.tar.gz
git-fcce17039cb94e6490a65a846b2375081785ce9b.tar.bz2
refs: document do_for_each_ref() and do_one_ref()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index ed1b4cf..6c8fe18 100644
--- a/refs.c
+++ b/refs.c
@@ -526,10 +526,14 @@ static void sort_ref_dir(struct ref_dir *dir)
dir->sorted = dir->nr = i;
}
-#define DO_FOR_EACH_INCLUDE_BROKEN 01
+/* Include broken references in a do_for_each_ref*() iteration: */
+#define DO_FOR_EACH_INCLUDE_BROKEN 0x01
static struct ref_entry *current_ref;
+/*
+ * Handle one reference in a do_for_each_ref*()-style iteration.
+ */
static int do_one_ref(const char *base, each_ref_fn fn, int trim,
int flags, void *cb_data, struct ref_entry *entry)
{
@@ -1339,6 +1343,15 @@ void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
for_each_rawref(warn_if_dangling_symref, &data);
}
+/*
+ * Call fn for each reference in the specified submodule for which the
+ * refname begins with base. If trim is non-zero, then trim that many
+ * characters off the beginning of each refname before passing the
+ * refname to fn. flags can be DO_FOR_EACH_INCLUDE_BROKEN to include
+ * broken references in the iteration. If fn ever returns a non-zero
+ * value, stop the iteration and return that value; otherwise, return
+ * 0.
+ */
static int do_for_each_ref(const char *submodule, const char *base, each_ref_fn fn,
int trim, int flags, void *cb_data)
{