From: Eyvind Bernhardsen Date: Sun, 16 Mar 2008 19:49:09 +0000 (+0100) Subject: fast-import: Allow "reset" to delete a new branch without error X-Git-Tag: v1.5.5-rc1~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=198724ad4ef0630892e8dbbab92e92ff4f979075;p=git.git 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 Acked-by: Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- diff --git a/fast-import.c b/fast-import.c index 655913ddb..73e5439d9 100644 --- a/fast-import.c +++ b/fast-import.c @@ -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);