summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07514c8)
raw | patch | inline | side by side (parent: 07514c8)
author | Jeff King <peff@peff.net> | |
Tue, 29 Mar 2011 20:55:32 +0000 (16:55 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 29 Mar 2011 21:29:17 +0000 (14:29 -0700) |
This function is useful for other commands besides "git
notes" which want to let users refer to notes by their
shorthand name.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes" which want to let users refer to notes by their
shorthand name.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c | patch | blob | history | |
notes.c | patch | blob | history | |
notes.h | patch | blob | history |
diff --git a/builtin/notes.c b/builtin/notes.c
index a0f310b72956dcb00d2a0899d39ddfb9f7811fa4..62276072fc7d6788b40dc8b27c578dfd8416c385 100644 (file)
--- a/builtin/notes.c
+++ b/builtin/notes.c
struct strbuf buf;
};
-static void expand_notes_ref(struct strbuf *sb)
-{
- if (!prefixcmp(sb->buf, "refs/notes/"))
- return; /* we're happy */
- else if (!prefixcmp(sb->buf, "notes/"))
- strbuf_insert(sb, 0, "refs/", 5);
- else
- strbuf_insert(sb, 0, "refs/notes/", 11);
-}
-
static int list_each_note(const unsigned char *object_sha1,
const unsigned char *note_sha1, char *note_path,
void *cb_data)
index a013c1bc638dbf5a8111183a3f9d154721ec5e04..f6b9b6a72aa7b157627c8d59e8b9025377f13d44 100644 (file)
--- a/notes.c
+++ b/notes.c
return 0;
}
+
+void expand_notes_ref(struct strbuf *sb)
+{
+ if (!prefixcmp(sb->buf, "refs/notes/"))
+ return; /* we're happy */
+ else if (!prefixcmp(sb->buf, "notes/"))
+ strbuf_insert(sb, 0, "refs/", 5);
+ else
+ strbuf_insert(sb, 0, "refs/notes/", 11);
+}
index 83bd6e0ec02a1a8650004f14cd7476eedbdff518..60bdf289a3fb053cf0010f66d7df41ae1d922b6a 100644 (file)
--- a/notes.h
+++ b/notes.h
void string_list_add_refs_from_colon_sep(struct string_list *list,
const char *globs);
+/* Expand inplace a note ref like "foo" or "notes/foo" into "refs/notes/foo" */
+void expand_notes_ref(struct strbuf *sb);
+
#endif