@matheusbsbs / matheus-bagliano / commits / bdfd739dac
Fork 0

Make the 'lock file' exists error more informative

It looks like someone did 90% of the work, then forgot to actually use the function in one place. Also the helper function did not use the correct variable. Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Tapsell committed Mar 4, 2009 at 15:00 UTC bdfd739dac4c109ce360d38d0572d8717a46e795
1 file changed +2 -2
lockfile.c
+2 -2
@@ -158,7 +158,7 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
158
159 NORETURN void unable_to_lock_index_die(const char *path, int err)
160 {
161 - if (errno == EEXIST) {
161 + if (err == EEXIST) {
162 die("Unable to create '%s.lock': %s.\n\n"
163 "If no other git process is currently running, this probably means a\n"
164 "git process crashed in this repository earlier. Make sure no other git\n"
@@ -184,7 +184,7 @@ int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags)
184 fd = lock_file(lk, path, flags);
185 if (fd < 0) {
186 if (flags & LOCK_DIE_ON_ERROR)
187 - die("unable to create '%s.lock': %s", path, strerror(errno));
187 + unable_to_lock_index_die(path, errno);
188 return fd;
189 }
190