summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-03 12:06:42 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-03 12:06:42 -0700
commit2e4b5dee97cb1524a88f0ee90450b139bfaff07b (patch)
tree92e5ac7b9d415f1dc22e78c25fa7b01b85a2e02a /sequencer.c
parent53f52cd92acb033df4a50d1557bae9c55c2d4d67 (diff)
parent55a5c8d72b03ad3727b89900069a1d58664fe5e4 (diff)
downloadgit-2e4b5dee97cb1524a88f0ee90450b139bfaff07b.tar.gz
Merge branch 'rs/ref-update-check-errors-early'
* rs/ref-update-check-errors-early: commit.c: check for lock error and return early sequencer.c: check for lock failure and bail early in fast_forward_to
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index bde5f047b0..0a80c58d11 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -281,8 +281,12 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
exit(1); /* the callee should have complained already */
ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from,
0, NULL);
+ if (!ref_lock)
+ return error(_("Failed to lock HEAD during fast_forward_to"));
+
strbuf_addf(&sb, "%s: fast-forward", action_name(opts));
ret = write_ref_sha1(ref_lock, to, sb.buf);
+
strbuf_release(&sb);
return ret;
}