-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected results on repo with filename case changes #24
Comments
What's the output of |
$ git config --local core.ignoreCase
true
$ git config --global core.ignoreCase
<empty output> I haven't changed it so it falls back to default values for |
Yeah, that's what I expected. When you clone a repository, git attempts to check if the filesystem is case-insensitive and sets that config value at clone time for the local repo accordingly. It looks like git in config.c sets ignore_case based on the setting of core.ignoreCase, and then fast-import.c uses fspathncmp() to compare entries, which when ignore_case is true translates to strncasecmp(). That means fast-import is treating two files within a single commit as the same file. fast-export will emit both a delete-old-file and create-new-file-with-same-contents directive (likely in alphabetical order of the filenames) whenever it sees a rename, but fast-import is basically ignoring whichever of those directives came first since it treats them as the same file and considers the second as an override. Can you try unsetting the local setting of core.ignoreCase ( |
Yes, you're right. |
Would be great to add this to the manual or readme. Or even embed to the script. I am using git-filter-repo as part of migration of two android repositories to the monorepo. Had an issues with project building on CI server (hosted on Linux) while it was running fine on my local machine (Mac OS). Had to spend almost two days to figure out that somewhere in the middle directory name was upper case while it is lowercase in the original repo. |
Sorry that insane broken-by-design filesystems caused you so much pain, it's a pity we can't just get rid of those and instead have to waste so many engineering cycles working around them. But, since they won't be going away, it does make sense to try to work around them where practical. Anyway, embedding the workaround in git-filter-repo is precisely the plan; this issue was left open as a reminder to do that. |
Okay, I added '-c core.ignorecase=false' to the command line for the git fast-import invocation, which should prevent anyone else from running into this issue (well, assuming they're using a the version from master or some future release of filter-repo). Thanks for the detailed report, @m4tiz5zktonj ! |
Hello.
I've encountered strange results after running
filter-repo
on repo than contains commits with filename case changes.I'm using latest stable releases of
git
,python
andfilter-repo
on Windows 10 1909.Steps to reproduce:
test.txt
andtrash.txt
files.test.txt
toTest.txt
. Has to do it via multiple renaming and amending, because I don't know another ways to do that, at least on Windows.git mv test.txt Test1.txt git commit -m "rename test.txt -> Test.txt" git mv Test1.txt Test.txt git commit --amend --no-edit
trash.txt
file.git rm trash.txt git commit -m "remove trash.txt"
Test.txt
.Test.txt
totest.txt
back.git mv Test.txt test2.txt git commit -m "rename Test.txt -> test.txt" git mv test2.txt test.txt git commit --amend --no-edit
test.txt
again.It should be similar to this:
tree
's id and contents ofHEAD
commit.filter-repo
to completely removetrash.txt
from history.Expected results:
trash.txt
is completely gone from history;tree
object of currentHEAD
is the same as it was before runningfilter-repo
;test.txt
is intree
ofHEAD
and its history contains single lines additions in appropriate commits.Actual results:
trash.txt
is completely gone from history: everything is OK here;tree
object of currentHEAD
differs: see below;test.txt
is not intree
ofHEAD
, it is replaced withTest.txt
and its history contains multiple lines additions: have a look at "rename Test.txt -> test.txt" and "rename Test.txt -> test.txt" commits diffs below.Here are
git log
andgit ls-tree
outputs on modified repo:I think, such behavior of
filter-repo
is not intended. Or am I missing something?Thanks in advance.
The text was updated successfully, but these errors were encountered: