Skip to content

Commit

Permalink
lockfile: show absolute filename in unable_to_lock_message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
moy authored and gitster committed Jan 12, 2010
1 parent 0def5b6 commit a8c37a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lockfile.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit a8c37a0

Please sign in to comment.