Thread (19 messages) flat view 19 messages, 3 authors, 2016-06-15
STALE3738d REVIEWED: 1 (0M)

Revision v2 of 3 in this series; 1 review trailer.

Revisions (3)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]

[PATCH v2 09/12] ref_transaction_delete(): check that old_sha1 is not null_sha1

From: Michael Haggerty <hidden>
Date: 2016-06-15 23:03:48
Subsystem: the rest · Maintainer: Linus Torvalds

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

Signed-off-by: Michael Haggerty <redacted>
Reviewed-by: Stefan Beller <redacted>
---
 refs.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/refs.c b/refs.c
index 3f78fac..9dd7932 100644
--- a/refs.c
+++ b/refs.c
@@ -3702,6 +3702,8 @@ int ref_transaction_delete(struct ref_transaction *transaction,
 			   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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help