I have just started learing GIT. Follow their tutorial.
Now at the very beginning I got stuck with this error:
Fatal: pathspec \'file.txt\' did not match
Note: you shouldn't see this particular error message in git 1.9/2.0 (Q1 2014).
See commit 64ed07c by Nguyễn Thái Ngọc Duy (pclouds):
add
: don't complain when adding empty project rootThis behavior was added in 07d7bed (add
: don't complain when adding
empty project root - 2009-04-28, git 1.6.3.2)
then broken by 84b8b5d (remove match_pathspec()
in favor of match_pathspec_depth()
- 2013-07-14, git 1.8.5).
Reinstate it.
The idea is:
We try to warn the user if one of their pathspecs caused no matches, as it may have been a typo. However, we disable the warning if the pathspec points to an existing file, since that means it is not a typo but simply an empty directory.
Unfortunately, the
file_exists()
test was broken for one special case: the pathspec of the project root is just "".
This patch detects this special case and acts as if the file exists (which it must, since it is the project root).The user-visible effect is that this:
$ mkdir repo && cd repo && git init && git add .
used to complain like:
fatal: pathspec '' did not match any files
but now is a silent no-op.
It is again a silent no-op in upcoming git 1.9/2.0 (Q1 2014)