summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-04-03 17:57:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-05 08:05:48 (GMT)
commit86238e07ef633f7488ac708578aaf71e4375c057 (patch)
tree9654c313bcfe887648594ac787b1e304b527a88e /t
parentfc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f (diff)
downloadgit-86238e07ef633f7488ac708578aaf71e4375c057.zip
git-86238e07ef633f7488ac708578aaf71e4375c057.tar.gz
git-86238e07ef633f7488ac708578aaf71e4375c057.tar.bz2
commit: allow partial commits with relative paths
Commit 8894d53580 (commit: allow partial commits with relative paths, 2011-07-30) ensured that partial commits were allowed when a user supplies a relative pathspec but then this was regressed in 5879f5684c (remove prefix argument from pathspec_prefix, 2011-09-04) when the prefix argument to 'pathspec_prefix' removed and the 'list_paths' function wasn't properly adjusted to cope with the change, resulting in over-eager pruning of the tree that is overlayed on the index. This fixes the regression and adds a regression test so this can be prevented in the future. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7501-commit.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index fa61b1a..9dbbd01 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -52,6 +52,18 @@ test_expect_success PERL 'can use paths with --interactive' '
git reset --hard HEAD^
'
+test_expect_success 'removed files and relative paths' '
+ test_when_finished "rm -rf foo" &&
+ git init foo &&
+ >foo/foo.txt &&
+ git -C foo add foo.txt &&
+ git -C foo commit -m first &&
+ git -C foo rm foo.txt &&
+
+ mkdir -p foo/bar &&
+ git -C foo/bar commit -m second ../foo.txt
+'
+
test_expect_success 'using invalid commit with -C' '
test_must_fail git commit --allow-empty -C bogus
'