It makes no sense to delete a reference that is already known not to
exist.

Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>
Reviewed-by: Stefan Beller <sbel...@google.com>
---
 refs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/refs.c b/refs.c
index b9cf284..d5bfd11 100644
--- a/refs.c
+++ b/refs.c
@@ -3702,6 +3702,8 @@ int ref_transaction_delete(struct ref_transaction 
*transaction,
                           unsigned int flags, const char *msg,
                           struct strbuf *err)
 {
+       if (old_sha1 && is_null_sha1(old_sha1))
+               die("BUG: delete called with old_sha1 set to zeros");
        return ref_transaction_update(transaction, refname,
                                      null_sha1, old_sha1,
                                      flags, msg, err);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to