Merge branch 'nd/add-empty-fix' into maint
"git add -A" (no other arguments) in a totally empty working tree used to emit an error. * nd/add-empty-fix: add: don't complain when adding empty project rootmaint
commit
ee5788e306
|
@ -544,7 +544,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
for (i = 0; i < pathspec.nr; i++) {
|
for (i = 0; i < pathspec.nr; i++) {
|
||||||
const char *path = pathspec.items[i].match;
|
const char *path = pathspec.items[i].match;
|
||||||
if (!seen[i] &&
|
if (!seen[i] && path[0] &&
|
||||||
((pathspec.items[i].magic &
|
((pathspec.items[i].magic &
|
||||||
(PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
|
(PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
|
||||||
!file_exists(path))) {
|
!file_exists(path))) {
|
||||||
|
|
|
@ -272,6 +272,25 @@ test_expect_success '"add non-existent" should fail' '
|
||||||
! (git ls-files | grep "non-existent")
|
! (git ls-files | grep "non-existent")
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git add -A on empty repo does not error out' '
|
||||||
|
rm -fr empty &&
|
||||||
|
git init empty &&
|
||||||
|
(
|
||||||
|
cd empty &&
|
||||||
|
git add -A . &&
|
||||||
|
git add -A
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success '"git add ." in empty repo' '
|
||||||
|
rm -fr empty &&
|
||||||
|
git init empty &&
|
||||||
|
(
|
||||||
|
cd empty &&
|
||||||
|
git add .
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'git add --dry-run of existing changed file' "
|
test_expect_success 'git add --dry-run of existing changed file' "
|
||||||
echo new >>track-this &&
|
echo new >>track-this &&
|
||||||
git add --dry-run track-this >actual 2>&1 &&
|
git add --dry-run track-this >actual 2>&1 &&
|
||||||
|
|
Loading…
Reference in New Issue