From 5290b0c8077fd4a48a525f9e6b1558e32fcdd637 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 6 Jul 2024 23:05:16 -0700 Subject: [PATCH] Restore test, define test prereq --- t/t9391-filter-repo-lib-usage.sh | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/t/t9391-filter-repo-lib-usage.sh b/t/t9391-filter-repo-lib-usage.sh index 6e62a70e..3a86961c 100755 --- a/t/t9391-filter-repo-lib-usage.sh +++ b/t/t9391-filter-repo-lib-usage.sh @@ -205,6 +205,44 @@ test_expect_success 'lint-history' ' ) ' +test_expect_success !WINDOWS 'lint-history --refs' ' + test_create_repo lint-history-only-some-refs && + ( + cd lint-history-only-some-refs && + test_commit a somefile bad && + test_commit b notherfile baaad && + test_commit c whatever baaaaaad && + git checkout -b mybranch HEAD~1 && + test_commit d somefile baaaaaaaad && + test_commit e whatever "baaaaaaaaaad to the bone" && + + cat <<-EOF >linter.sh && + #!/bin/bash + cat \$1 | tr -d a >tmp + mv tmp \$1 + EOF + chmod u+x linter.sh && + + PATH=$PATH:. $CONTRIB_DIR/lint-history --refs master..mybranch -- linter.sh && + + echo bd >expect && + echo bd to the bone >long-expect && + + # Verify master is untouched + git checkout master && + ! test_cmp somefile expect && + ! test_cmp notherfile expect && + ! test_cmp whatever expect && + + # Verify that files touched on the branch are tweaked + git checkout mybranch && + test_cmp somefile expect && + ! test_cmp notherfile expect && + test_cmp whatever long-expect + + ) +' + test_expect_success 'clean-ignore with emoji in filenames' ' test_create_repo clean-ignore && (