commit.c: check for lock error and return early
commit55a5c8d72b03ad3727b89900069a1d58664fe5e4
authorRonnie Sahlberg <sahlberg@google.com>
Wed, 16 Apr 2014 18:56:53 +0000 (16 11:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Apr 2014 19:57:13 +0000 (17 12:57 -0700)
treebef05af1d24237fb702958193898c2df1305bda2
parent651ab9f553a1fd8bb847bd42922dacb14f8ec77f
commit.c: check for lock error and return early

Move the check for the lock failure to happen immediately after
lock_any_ref_for_update().  Previously the lock and the
check-if-lock-failed was separated by a handful of string
manipulation statements.

Moving the check to occur immediately after the failed lock makes
the code slightly easier to read and makes it follow the pattern of

 try-to-take-a-lock();
 if (check-if-lock-failed) {
    error();
 }

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c