1

I have a folder with files in my woring directory, not yet under version control. If I right click on the folder and go to TortoiseGit -> Add I get the message:

There is nothing to add. All the files and folders are either under version control, have been ignored or the global ignore configuration setting.

When I go into the folder and select the individual files I can add them. And if I start a command line and use git add --all it does what I want TortoiseGit to do and adds recursively.

According to the TortoiseGit Manual it should be able to do this:

Many Adds: You can also use the Add command on folders. In that case, the add dialog will show you all unversioned files inside that versioned folder. This helps if you have many new files and need to add them all at once.

What am I missing?

MrTux
  • 32,350
  • 30
  • 109
  • 146
Toby
  • 203
  • 1
  • 7
  • Which version are you using (of TortoiseGit and Git for Windows)? – MrTux Jun 23 '17 at 10:14
  • TortoiseGit 2.4.0.2 git version 2.12.3 (via cygwin) – Toby Jun 23 '17 at 12:57
  • I suppose this is a Cygwin issue. Please note that Cygwin Git is kinda broken in windows as it doesn't even pass the whole test suite. – MrTux Jun 23 '17 at 13:55
  • Any idea why git add --all works then? Might try move to git for windows then – Toby Jun 23 '17 at 14:14
  • TortoiseGit does not call `git add --all`, but calls git to list unversioned/ignored files first. It might be possible, that cygwin git does not output all files here. It would be nice if you could try to debug this (cf. https://tortoisegit.org/debug). – MrTux Jun 23 '17 at 14:37

2 Answers2

1

Cygwin Git requires a special HACK to be enabled in TortoiseGit in order to enable some workarounds (cf. https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html and search for "Cygwin"). With this flag enabled, the issue you are talking about is solved.

PS: Please note that Cygwin Git is kinda broken on Windows as it doesn't even pass the whole test suite. Therefore it is not fully supported by TortoiseGit. Git for Windows is recommended (cf. https://stackoverflow.com/a/32427897/3906760)

MrTux
  • 32,350
  • 30
  • 109
  • 146
-1

The problem was a bug in TortoiseGit/Cygwin to do with the following line (executed in the debug log):

"C:\path\to\git.exe" ls-files --exclude-standard --full-name --others -z -- "dir\subdir"

The command outputs a list of file locations relative to the woking copy home not yet in the repo and the -- "dir\subdir" searches this list for files in the current dir\subdir.

Cygwin being cygwin outputs the files with a forward slash "dir/subdir" so the search returns no files.

This bug only appears when the add is attempted in the 2nd level of the working copy (top level and 1 level down work as they have no "\" in the search).

EDIT: the answer from MrTux is correct as the CygwinHack value was false

Toby
  • 203
  • 1
  • 7