[PATCH 1/2] t3700 (add): add two tests for testing add with submodules
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Apr 9, 2013, 09:21 UTC
- Message-ID
- <1365499297-8667-2-git-send-email-artagnon@gmail.com>
- In-Reply-To
- <1365499297-8667-1-git-send-email-artagnon@gmail.com>
The first test "git add should not go past gitlink boundaries" checks that paths within a submodule added with 'git submodule add' cannot be added to the index. It passes because of treat_gitlink() in builtin/add.c.
The second test "git add should not go past git repository boundaries" checks that paths within a git repository in the worktree (not yet added with 'git submodule add') cannot be added to the index. It fails because there is no existing code to check this.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> --- t/t3700-add.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 874b3a6..1ad2331 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -310,4 +310,36 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out test_i18ncmp expect.err actual.err ' +test_expect_success 'git add should not go past gitlink boundaries' ' + rm -rf submodule_dir && + mkdir submodule_dir && + ( + cd submodule_dir && + git init && + git config remote.origin.url "quux" && + cat >foo <<-\EOF && + Some content + EOF + git add foo && + git commit -a -m "Add foo" + ) && + git submodule add ./submodule_dir && + test_must_fail git add submodule_dir/foo +' + +test_expect_failure 'git add should not go past git repository boundaries' ' + rm -rf submodule_dir && + mkdir submodule_dir && + ( + cd submodule_dir && + git init && + cat >foo <<-\EOF && + Some content + EOF + git add foo && + git commit -a -m "Add foo" + ) && + test_must_fail git add submodule_dir/foo +' + test_done
-- 1.8.2.1.347.gdd82260.dirty