0

Following strange happens on my machine:

git status claims the working tree to be clean.

manuel@manuelthinkpad:~/projects/PROJECTNAME/modules/MODULENAME$ git status
On branch BRANCHNAME
Your branch is up-to-date with 'origin/BRANCHNAME'.
nothing to commit, working tree clean

Still git add * adds two directories:

manuel@manuelthinkpad:~/projects/PROJECTNAME/modules/MODULENAME$ git add *
manuel@manuelthinkpad:~/projects/PROJECTNAME/modules/MODULENAME$ git status
On branch BRANCHNAME
Your branch is up-to-date with 'origin/BRANCHNAME'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   dir1
    modified:   dir2

git diff --cached doesn't give any details on these changes.

manuel@manuelthinkpad:~/projects/PROJECTNAME/modules/MODULENAME$ git diff --cached
manuel@manuelthinkpad:~/projects/PROJECTNAME/modules/MODULENAME$ 

Can anyone tell me what's going on here? How do get git to tell me why it adds these directories?

I read something about CRLF-related problems, but if I read git config --list correctly, none of this CRLF-ignore-functionality is activated. (I removed *.url, *.fetch, *.remote and *.merge entries from this list.)

user.name=xxx
user.email=xxx
diff.tool=meld
difftool.prompt=false
difftool.meld.cmd=meld $LOCAL $REMOTE
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.worktree=../../../../xxx
Multisync
  • 767
  • 6
  • 25
  • What version of Git is this, and are you using submodules? – torek May 22 '17 at 09:52
  • Empty directories are ignored in git. I can't reproduce this problem on my computer. Are these directories empty? – Liran Funaro May 22 '17 at 09:53
  • 1
    @LiranFunaro: I suspect he has submodules named `dir1` and `dir2` and the use of `meld` for diff is preventing Git from showing the submodule status. (Since I avoid submodules generally, and don't use `meld` at all, I can't really test any of this.) – torek May 22 '17 at 09:58
  • @torek this seems possible, but he didn't specify what these folder contain. – Liran Funaro May 22 '17 at 10:01
  • do the names of the directories begin with a '.' ? – Raghvendra Kumar May 22 '17 at 10:02
  • I think when you do a git add * then it involves your shell also.. http://stackoverflow.com/questions/26042390/git-add-asterisk-vs-git-add-period – Raghvendra Kumar May 22 '17 at 10:09
  • @torek: It is `git version 2.11.0` and yes, we're using submodules. However, the two directories are not submoduled, I think. (If they were submodules, they would violate the directory structure.) – Multisync May 22 '17 at 10:20
  • @RaghvendraKumar: No, these are ordinary directories, they are not prefixed with '.'. – Multisync May 22 '17 at 10:21
  • were these directories present before or newly added ? If they were not present before then git status will not show it as they are untracked and it's only after you do a git add for the new one they are being tracked by git. – Raghvendra Kumar May 22 '17 at 10:28
  • 1
    @RaghvendraKumar but `status` would then show them as untracked, not saying "working tree clean". @Multisync did you mangle with the output you showed too much maybe? Because Git does not track directories. So having the directories shown in `status` output without explicitly showing files in there is quite impossible. – Vampire May 22 '17 at 10:49
  • Does the directories include a file named `.gitkeep`? – Liran Funaro May 22 '17 at 11:57
  • @torek and others: I think I owe you people an apology. I just did some reading on git submodules, and as it turned out these directories are submodules indeed. This came as a surprise, as the directory structure does not allow for submodules in this place. Still, why are these directories always getting added with `git add *`? Shouldn't changes in submodules being treated differently? – Multisync May 23 '17 at 09:03
  • Submodules (aka "sob"-modules, as in, they make you cry :-) ) are a pain for many reasons. I don't use external diffs normally and have never used `meld` at all so I am not sure how those affect things, but in general, `git diff` has to treat submodules specially, since they're actually separate repositories. The details have evolved over time so some of this is Git-version-dependent as well. – torek May 23 '17 at 09:22
  • @torek: After all the reading I've done now I'm very skeptical about submodules as well. :-( By the way: `git diff` should not use `meld`, altough one could certainly assume so. See this post: https://stackoverflow.com/a/34119867/3787646 – Multisync May 23 '17 at 09:58

0 Answers0