author | Jeff King <peff@peff.net> | |
Wed, 29 Apr 2009 03:21:01 +0000 (23:21 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 9 May 2009 15:27:11 +0000 (08:27 -0700) | ||
commit | 07d7bedda8d18ffbfe5960ce27b73a24c01cac1a | |
tree | c5a359d8fea474ec03662eff156162f2c9d61f0a | tree | snapshot |
parent | ec00d6e0038e030cf73182374e21025c2776cb23 | commit | diff |
add: don't complain when adding empty project root
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.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-add.c | diff | blob | history |