summaryrefslogtreecommitdiffstats
path: root/sha1-file.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-05-10 17:42:52 +0000
committerJunio C Hamano <gitster@pobox.com>2018-05-22 12:38:02 +0900
commit33286dcd6d79eeb81b74f36a324f260275582639 (patch)
tree3eb8a1258b3916cb1840bcbfcf550bcf2d99d3f6 /sha1-file.c
parent1472978ec670e57913836dcc98ba9cf560d94a1c (diff)
downloadgit-33286dcd6d79eeb81b74f36a324f260275582639.tar.gz
git-33286dcd6d79eeb81b74f36a324f260275582639.tar.xz
commit-graph: fix UX issue when .lock file exists
We use the lockfile API to avoid multiple Git processes from writing to the commit-graph file in the .git/objects/info directory. In some cases, this directory may not exist, so we check for its existence. The existing code does the following when acquiring the lock: 1. Try to acquire the lock. 2. If it fails, try to create the .git/object/info directory. 3. Try to acquire the lock, failing if necessary. The problem is that if the lockfile exists, then the mkdir fails, giving an error that doesn't help the user: "fatal: cannot mkdir .git/objects/info: File exists" While technically this honors the lockfile, it does not help the user. Instead, do the following: 1. Check for existence of .git/objects/info; create if necessary. 2. Try to acquire the lock, failing if necessary. The new output looks like: fatal: Unable to create '<dir>/.git/objects/info/commit-graph.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1-file.c')
0 files changed, 0 insertions, 0 deletions