From 4db464f815a38c7d9feee5db883f78216002ae3d Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 7 Sep 2017 16:02:20 +0200 Subject: [PATCH 1/4] t7004: move limited stack prereq to test-lib The lazy prerequisite ULIMIT_STACK_SIZE is used only in t7004 so far. Move it to test-lib.sh so that it can be used in other tests (which it will be in a follow-up commit). Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 6 ------ t/test-lib.sh | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index dbcd6f623c..5bf5ace56b 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1863,12 +1863,6 @@ test_expect_success 'version sort with very long prerelease suffix' ' git tag -l --sort=version:refname ' -run_with_limited_stack () { - (ulimit -s 128 && "$@") -} - -test_lazy_prereq ULIMIT_STACK_SIZE 'run_with_limited_stack true' - # we require ulimit, this excludes Windows test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' ' >expect && diff --git a/t/test-lib.sh b/t/test-lib.sh index 5fbd8d4a90..f22c1b260a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1167,6 +1167,12 @@ run_with_limited_cmdline () { test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true' +run_with_limited_stack () { + (ulimit -s 128 && "$@") +} + +test_lazy_prereq ULIMIT_STACK_SIZE 'run_with_limited_stack true' + build_option () { git version --build-options | sed -ne "s/^$1: //p" From a24fa652962007e03ac02e25952bf45ddff5bfde Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 7 Sep 2017 16:02:21 +0200 Subject: [PATCH 2/4] t6120: test name-rev --all and --stdin name-rev is used in a few tests, but tested only in t6120 along with describe so far. Add tests for name-rev with --all and --stdin. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t6120-describe.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index aa74eb8f0d..7c5728ebd5 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -198,6 +198,31 @@ test_expect_success 'name-rev with exact tags' ' test_cmp expect actual ' +test_expect_success 'name-rev --all' ' + >expect.unsorted && + for rev in $(git rev-list --all) + do + git name-rev $rev >>expect.unsorted + done && + sort expect && + git name-rev --all >actual.unsorted && + sort actual && + test_cmp expect actual +' + +test_expect_success 'name-rev --stdin' ' + >expect.unsorted && + for rev in $(git rev-list --all) + do + name=$(git name-rev --name-only $rev) && + echo "$rev ($name)" >>expect.unsorted + done && + sort expect && + git rev-list --all | git name-rev --stdin >actual.unsorted && + sort actual && + test_cmp expect actual +' + test_expect_success 'describe --contains with the exact tags' ' echo "A^0" >expect && tag_object=$(git rev-parse refs/tags/A) && From ac9b24015c8ecb828485585295c072635bebd73b Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 7 Sep 2017 16:02:22 +0200 Subject: [PATCH 3/4] t6120: clean up state after breaking repo t6120 breaks the repo state intentionally in the last tests. Clean up the breakage afterwards (and before adding more tests). Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t6120-describe.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 7c5728ebd5..1997ccde56 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -275,6 +275,7 @@ test_expect_success 'describe chokes on severely broken submodules' ' ' test_expect_success 'describe ignoring a borken submodule' ' git describe --broken >out && + test_when_finished "mv .git/modules/sub_moved .git/modules/sub1" && grep broken out ' From 31625b34c0e54ae184f28aa5eb5095d21204557e Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 7 Sep 2017 16:02:23 +0200 Subject: [PATCH 4/4] t6120: test describe and name-rev with deep repos Depending on the implementation of walks, limitted stack size may lead to problems (for recursion). Test name-rev and describe with deep repos and limitted stack size and mark the former with known failure. We add these tests (which add gazillions of commits) last so as to keep the runtime of other subtests the same. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t6120-describe.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 1997ccde56..dd6dd9df9b 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -279,4 +279,35 @@ test_expect_success 'describe ignoring a borken submodule' ' grep broken out ' +# we require ulimit, this excludes Windows +test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' ' + i=1 && + while test $i -lt 8000 + do + echo "commit refs/heads/master +committer A U Thor $((1000000000 + $i * 100)) +0200 +data <expect && + git name-rev HEAD~4000 >actual && + test_cmp expect actual && + run_with_limited_stack git name-rev HEAD~4000 >actual && + test_cmp expect actual +' + +test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' ' + git tag -f far-far-away HEAD~7999 && + echo "far-far-away" >expect && + git describe --tags --abbrev=0 HEAD~4000 >actual && + test_cmp expect actual && + run_with_limited_stack git describe --tags --abbrev=0 HEAD~4000 >actual && + test_cmp expect actual +' + test_done