summaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2010-01-07 14:54:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-12 23:48:24 (GMT)
commita8c37a0e011d67e3192834a0fffe17452ea57a08 (patch)
treec05b70d3451f1b22a3eb076273bb3942616954d1 /lockfile.c
parent0def5b6ed4ffbc2cced3206acd6359178f7b8c5d (diff)
downloadgit-a8c37a0e011d67e3192834a0fffe17452ea57a08.zip
git-a8c37a0e011d67e3192834a0fffe17452ea57a08.tar.gz
git-a8c37a0e011d67e3192834a0fffe17452ea57a08.tar.bz2
lockfile: show absolute filename in unable_to_lock_message
When calling a git command from a subdirectory and a file locking fails, the user will get a path relative to the root of the worktree, which is invalid from the place where the command is ran. Make it easy for the user to know which file it is. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'lockfile.c')
-rw-r--r--lockfile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lockfile.c b/lockfile.c
index 6851fa5..b0d74cd 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -164,9 +164,10 @@ static char *unable_to_lock_message(const char *path, int err)
"If no other git process is currently running, this probably means a\n"
"git process crashed in this repository earlier. Make sure no other git\n"
"process is running and remove the file manually to continue.",
- path, strerror(err));
+ make_nonrelative_path(path), strerror(err));
} else
- strbuf_addf(&buf, "Unable to create '%s.lock': %s", path, strerror(err));
+ strbuf_addf(&buf, "Unable to create '%s.lock': %s",
+ make_nonrelative_path(path), strerror(err));
return strbuf_detach(&buf, NULL);
}