From 2b56bb7a87ab429c225f6325f2870cbeac0d19f9 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 24 Feb 2016 13:15:02 -0800 Subject: submodule helper list: respect correct path prefix This is a regression introduced by 74703a1e4d (submodule: rewrite `module_list` shell function in C, 2015-09-02). Add a test to ensure we list the right submodule when giving a specific pathspec. Reported-By: Caleb Jorden Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 540771ca41..be82a75e54 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -999,5 +999,30 @@ test_expect_success 'submodule add clone shallow submodule' ' ) ' +test_expect_success 'submodule helper list is not confused by common prefixes' ' + mkdir -p dir1/b && + ( + cd dir1/b && + git init && + echo hi >testfile2 && + git add . && + git commit -m "test1" + ) && + mkdir -p dir2/b && + ( + cd dir2/b && + git init && + echo hello >testfile1 && + git add . && + git commit -m "test2" + ) && + git submodule add /dir1/b dir1/b && + git submodule add /dir2/b dir2/b && + git commit -m "first submodule commit" && + git submodule--helper list dir1/b |cut -c51- >actual && + echo "dir1/b" >expect && + test_cmp expect actual +' + test_done -- cgit v1.2.1