git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/7] write_ref_sha1(): remove check for lock == NULL

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Mar 2, 2015, 09:29 UTC
Message-ID
<1425288597-20547-2-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1425288597-20547-1-git-send-email-mhagger@alum.mit.edu>

None of the callers pass NULL to this function, and there doesn't seem to be any usefulness to allowing them to do so.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
---
 refs.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/refs.c b/refs.c
index ab2f2a9..e82d503 100644
--- a/refs.c
+++ b/refs.c
@@ -3079,10 +3079,6 @@ static int write_ref_sha1(struct ref_lock *lock,
 	static char term = '\n';
 	struct object *o;
 
-	if (!lock) {
-		errno = EINVAL;
-		return -1;
-	}
 	if (!lock->force_write && !hashcmp(lock->old_sha1, sha1)) {
 		unlock_ref(lock);
 		return 0;
-- 
2.1.4
Previous: Michael HaggertyNext: Michael Haggerty
Message 2 of 13 in “Fix some problems with reflog expiration”
  1. 0/7 Fix some problems with reflog expirationMichael Haggerty, Mar 2, 2015
  2. 1/7 write_ref_sha1(): remove check for lock == NULLMichael Haggerty, Mar 2, 2015
  3. 2/7 write_ref_sha1(): Move write elision test to callersMichael Haggerty, Mar 2, 2015
  4. 3/7 lock_ref_sha1_basic(): do not set force_write for missing referencesMichael Haggerty, Mar 2, 2015
  5. 4/7 struct ref_lock: delete the force_write memberMichael Haggerty, Mar 2, 2015
  6. Junio C HamanoMar 2, 2015
  7. Michael HaggertyMar 3, 2015
  8. 5/7 reflog: improve and update documentationMichael Haggerty, Mar 2, 2015
  9. Junio C HamanoMar 2, 2015
  10. Michael HaggertyMar 3, 2015
  11. 6/7 reflog_expire(): ignore --updateref for symbolic referencesMichael Haggerty, Mar 2, 2015
  12. 7/7 reflog_expire(): never update a reference to null_sha1Michael Haggerty, Mar 2, 2015
  13. Junio C HamanoMar 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.