notes: allow merging from arbitrary references
Create a new expansion function, expand_loose_notes_ref which will first check whether the ref can be found using get_sha1. If it can't be found then it will fallback to using expand_notes_ref. The content of the strbuf will not be changed if the notes ref can be located using get_sha1. Otherwise, it may be updated as done by expand_notes_ref. Since we now support merging from non-notes refs, remove the test case associated with that behavior. Add a test case for merging from a non-notes ref. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Reviewed-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
28274d02c4
commit
b3715b7522
10
notes.c
10
notes.c
@ -1303,3 +1303,13 @@ void expand_notes_ref(struct strbuf *sb)
|
||||
else
|
||||
strbuf_insert(sb, 0, "refs/notes/", 11);
|
||||
}
|
||||
|
||||
void expand_loose_notes_ref(struct strbuf *sb)
|
||||
{
|
||||
unsigned char object[20];
|
||||
|
||||
if (get_sha1(sb->buf, object)) {
|
||||
/* fallback to expand_notes_ref */
|
||||
expand_notes_ref(sb);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user