From 03bb5789cd97de989897e1c9de71a2831ada0544 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 29 Mar 2011 16:55:32 -0400 Subject: notes: make expand_notes_ref globally accessible 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 Signed-off-by: Junio C Hamano --- notes.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'notes.c') diff --git a/notes.c b/notes.c index a013c1bc63..f6b9b6a72a 100644 --- a/notes.c +++ b/notes.c @@ -1285,3 +1285,13 @@ int copy_note(struct notes_tree *t, 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); +} -- cgit v1.2.3