summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2018-05-09 20:55:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-10 05:54:45 (GMT)
commit3c6fad4a3fcc9a01dd3d9678360907271ad85920 (patch)
treedc37e889e09f40b8b5f72d9838d5ce6c93cd4413 /builtin/gc.c
parent010845157ae748bc35af84cfedf0803379c6e02b (diff)
downloadgit-3c6fad4a3fcc9a01dd3d9678360907271ad85920.zip
git-3c6fad4a3fcc9a01dd3d9678360907271ad85920.tar.gz
git-3c6fad4a3fcc9a01dd3d9678360907271ad85920.tar.bz2
refs.c: do not die if locking fails in `delete_pseudoref()`
After taking the lock we check whether we got it and die otherwise. But since we take the lock using `LOCK_DIE_ON_ERROR`, we would already have died. Considering the choice between dropping the dead code and dropping the flag, let's go for option number three: Drop the flag, write an error instead of dying, then return -1. This function already returns -1 for another error, so the caller (or rather, its callers) should be able to handle this. There is some inconsistency around how we handle errors in this function and elsewhere in this file, but let's take this small step towards gentle error-reporting now and leave the rest for another time. While at it, make the lock non-static and reduce its scope. (Placing `struct lock_file`s on the stack used to be a bad idea, because the temp- and lockfile-machinery would keep a pointer into the struct. But after 076aa2cbd (tempfile: auto-allocate tempfiles on heap, 2017-09-05), we can safely have lockfiles on the stack.) Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
0 files changed, 0 insertions, 0 deletions