]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ex/deprecate-empty-pathspec-as-match-all'
authorJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 04:11:29 +0000 (13:11 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 04:11:29 +0000 (13:11 +0900)
The final step to make an empty string as a pathspec element
illegal.  We started this by first deprecating and warning a
pathspec that has such an element in 2.11 (Nov 2016).

Hopefully we can merge this down to the 'master' by the end of the
year?  A deprecation warning period that is about 1 year does not
sound too bad.

* ex/deprecate-empty-pathspec-as-match-all:
  pathspec: die on empty strings as pathspec
  t0027: do not use an empty string as a pathspec element

1  2 
pathspec.c
t/t0027-auto-crlf.sh
t/t3600-rm.sh
t/t3700-add.sh

diff --cc pathspec.c
Simple merge
Simple merge
diff --cc t/t3600-rm.sh
Simple merge
diff --cc t/t3700-add.sh
index 0aae21d6984bf0bd5c7c7de425a021da6122beee,6357d6e74e6e50876924574aa30578c7bb411577..2748805642201d7c514792bab8d8b3940fb4086c
@@@ -331,77 -332,8 +331,76 @@@ test_expect_success 'git add --dry-run 
        test_i18ncmp expect.err actual.err
  '
  
- test_expect_success 'git add empty string should invoke warning' '
-       git add "" 2>output &&
-       test_i18ngrep "warning: empty strings" output
+ test_expect_success 'git add empty string should fail' '
+       test_must_fail git add ""
  '
  
 +test_expect_success 'git add --chmod=[+-]x stages correctly' '
 +      rm -f foo1 &&
 +      echo foo >foo1 &&
 +      git add --chmod=+x foo1 &&
 +      test_mode_in_index 100755 foo1 &&
 +      git add --chmod=-x foo1 &&
 +      test_mode_in_index 100644 foo1
 +'
 +
 +test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
 +      git config core.filemode 1 &&
 +      git config core.symlinks 1 &&
 +      rm -f foo2 &&
 +      echo foo >foo2 &&
 +      git add --chmod=+x foo2 &&
 +      test_mode_in_index 100755 foo2
 +'
 +
 +test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
 +      rm -f foo3 xfoo3 &&
 +      git reset --hard &&
 +      echo foo >foo3 &&
 +      git add foo3 &&
 +      git add --chmod=+x foo3 &&
 +      test_mode_in_index 100755 foo3 &&
 +      echo foo >xfoo3 &&
 +      chmod 755 xfoo3 &&
 +      git add xfoo3 &&
 +      git add --chmod=-x xfoo3 &&
 +      test_mode_in_index 100644 xfoo3
 +'
 +
 +test_expect_success POSIXPERM 'git add --chmod=[+-]x does not change the working tree' '
 +      echo foo >foo4 &&
 +      git add foo4 &&
 +      git add --chmod=+x foo4 &&
 +      ! test -x foo4
 +'
 +
 +test_expect_success 'no file status change if no pathspec is given' '
 +      >foo5 &&
 +      >foo6 &&
 +      git add foo5 foo6 &&
 +      git add --chmod=+x &&
 +      test_mode_in_index 100644 foo5 &&
 +      test_mode_in_index 100644 foo6
 +'
 +
 +test_expect_success 'no file status change if no pathspec is given in subdir' '
 +      mkdir -p sub &&
 +      (
 +              cd sub &&
 +              >sub-foo1 &&
 +              >sub-foo2 &&
 +              git add . &&
 +              git add --chmod=+x &&
 +              test_mode_in_index 100644 sub-foo1 &&
 +              test_mode_in_index 100644 sub-foo2
 +      )
 +'
 +
 +test_expect_success 'all statuses changed in folder if . is given' '
 +      git add --chmod=+x . &&
 +      test $(git ls-files --stage | grep ^100644 | wc -l) -eq 0 &&
 +      git add --chmod=-x . &&
 +      test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0
 +'
 +
  test_done