When i hit 'git status', it shows 2 folders that contains files that are tracked long time ago:
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/UI/Views/Shared/EditorTemplates/
# src/Web/helpers/
nothing added to commit but untracked files present (use "git add" to track)
Git GUI shows nothing as expected.
Using portablegit 1.7.1, but tried 1.7.0.2 - same results.
What can cause that?
$ cat .gitignore
.nu/*
lib/*
*~
*.swp
*.swo
*_ReSharper*
doc/*
RAPLM.suo
RAPLM.5.1.ReSharper.user
src/*/bin/*
src/*/obj/*
src/*/Debug/*
src/*/Release/*
src/Domain/unused
@Charles Bailey
lapsaarn@WW021198 /d/work/asdf (master)
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/UI/Views/Shared/EditorTemplates/
# src/Web/helpers/
nothing added to commit but untracked files present (use "git add" to track)
lapsaarn@WW021198 /d/work/asdf (master)
$ git add src/Web/helpers/
lapsaarn@WW021198 /d/work/asdf (master)
$ git add src/Web/helpers/*
lapsaarn@WW021198 /d/work/asdf (master)
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/UI/Views/Shared/EditorTemplates/
# src/Web/helpers/
nothing added to commit but untracked files present (use "git add" to track)
lapsaarn@WW021198 /d/work/asdf (master)
$
@Charles
$ git ls-tree -r HEAD | grep -i helpers
100644 blob 843de27f850308786140a7c09f67b5ef99184630 src/web/helpers/HtmlHelperExtensions.cs
Charles Bailey correctly diagnosed the problem in the comments: "git add
" on a case insensitive Os.
It is linked to issue 286 of msysgit: "Case Sensitity of Directory Names", and the issue remains (again, for directories) even if you set core.ignorecase
to true.
When you add "src\Web
" (with a capital 'W
'), it won't add anything if your index already contains "src\web
" (lowercase 'w
').
A patch was proposed but rejected:
The folder seems to be listed as untracked because
directory_exists_in_index()
tries to compare the old name to the new name, and ending up not finding a match for the new folder (even though the file inside it remains tracked!).
A very rude patch (inlined below) was written to try to work around the issue.
Now... for my minimal case, this works - the directory is no longer listed as untracked. But I strongly expect this to be a BROKEN patch for at least the following reason: Case insensitive comparison should break binary searching, as the casing should return the wrong position if I had more files in the index.
dir.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dir.c b/dir.c
index e05b850..c55a15c 100644
--- a/dir.c
+++ b/dir.c
@@ -444,7 +444,7 @@ static enum exist_status directory_exists_in_index(const char
*dirname, int len)
struct cache_entry *ce = active_cache[pos++];
unsigned char endchar;
- if (strncmp(ce->name, dirname, len))
+ if (strnicmp(ce->name, dirname, len))
break;
endchar = ce->name[len];
if (endchar > '/')
--
1.6.4.msysgit.0.2.gcb017.dirty
So you need to:
Web
' into 'web
' in your working directory (filesystem)web
' into 'Web
' in the index (git mv src/web src/Web
) in your index.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With