Skip to content

Commit

Permalink
fast-import: Allow "reset" to delete a new branch without error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eyvind Bernhardsen authored and Junio C Hamano committed Mar 16, 2008
1 parent 20fd60b commit 198724a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,8 @@ static int update_branch(struct branch *b)
struct ref_lock *lock;
unsigned char old_sha1[20];

if (is_null_sha1(b->sha1))
return 0;
if (read_ref(b->name, old_sha1))
hashclr(old_sha1);
lock = lock_any_ref_for_update(b->name, old_sha1, 0);
Expand Down

0 comments on commit 198724a

Please sign in to comment.