Skip to content

Commit 198724a

Browse files
Eyvind Bernhardsengitster
authored andcommitted
fast-import: Allow "reset" to delete a new branch without error
Creating a branch in fast-import and then resetting it without making any further commits to it currently causes an error message at the end of the import. This error is triggered by cvs2svn's git backend, which uses a temporary fixup branch when it creates tags, because the fixup branch is reset after each tag. This patch prevents the error, allowing "reset" to be used to delete temporary branches. Signed-off-by: Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no> Acked-by: Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 20fd60b commit 198724a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fast-import.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,8 @@ static int update_branch(struct branch *b)
15161516
struct ref_lock *lock;
15171517
unsigned char old_sha1[20];
15181518

1519+
if (is_null_sha1(b->sha1))
1520+
return 0;
15191521
if (read_ref(b->name, old_sha1))
15201522
hashclr(old_sha1);
15211523
lock = lock_any_ref_for_update(b->name, old_sha1, 0);

0 commit comments

Comments
 (0)