git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.31k stars 2.52k forks source link

Getting "Rename failed" question with commit-graph enabled and automatic git gc #2070

Closed t-b closed 5 years ago

t-b commented 5 years ago

Setup

64-bit

$ git --version --build-options

git version 2.21.0.rc0.windows.1
cpu: x86_64
built from commit: 90e6f79403cde5aac607ce29510fe689a3f7455e
sizeof-long: 4
sizeof-size_t: 8

7 64-bit

$ cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]
$ cat /etc/install-options.txt
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Performance Tweaks FSCache: Enabled
Use Credential Manager: Disabled
Enable Symlinks: Disabled

core.commitGraph = true gc.writeCommitGraph = true

Details

Bash

After adding a commit and gc kicking in I get

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Enumerating objects: 1064, done.
Counting objects: 100% (264/264), done.
Delta compression using up to 12 threads
Compressing objects: 100% (264/264), done.
Writing objects: 100% (264/264), done.
Total 264 (delta 150), reused 0 (delta 0)
Computing commit graph generation numbers: 100% (6510/6510), done.
Rename from 'E:/projekte/mies-igor/.git/objects/info/commit-graph.lock' to 'E:/projekte/mies-igor/.git/objects/info/commit-graph' failed. Should I try again? (y/n)
dscho commented 5 years ago

This should have been prevented by this call:

https://github.com/git-for-windows/git/blob/v2.21.0-rc2.windows.1/commit-graph.c#L1052

Sorry, without an MCVE I cannot really dig further.

t-b commented 5 years ago

@dscho Thanks for the code pointer.

My envisoned MWE would be

#!/bin/sh

set -e

rm -rf test

mkdir test
cd test
git init
git config --local gc.auto 10
git config --local gc.writeCommitGraph 1
git config --local core.commitGraph 1
git checkout -b feature
echo "" > file.txt
git add file.txt
for i in `seq 1 100`;
do
  echo $i >> file.txt
  git commit --quiet -m "blah" file.txt
done

git gc

but I can't replicate it with that ATM.

I'll reopen if I can reproduce it again.