From c384de075cc4cb01023b1c74dccd5f64da2e46e0 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 10 Sep 2019 18:20:39 +0000 Subject: [PATCH] t: add a test for shell characters in paths Now that we've included gitobj v1.4.1, add a test for the failure case we had in the past to prevent us from regressing this behavior. Check that shell characters within a pathname don't cause a failure when we open the pack file. Choose brackets since these are available on all platforms, including Windows. --- t/t-fsck.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/t-fsck.sh b/t/t-fsck.sh index 830791de..64f4b6a1 100755 --- a/t/t-fsck.sh +++ b/t/t-fsck.sh @@ -98,6 +98,30 @@ begin_test "fsck dry run" ) end_test +begin_test "fsck does not fail with shell characters in paths" +( + set -e + + mkdir '[[path]]' + cd '[[path]]' + reponame="fsck-shell-paths" + git init $reponame + cd $reponame + + # Create a commit with some files tracked by git-lfs + git lfs track *.dat + echo "test data" > a.dat + echo "test data 2" > b.dat + git add .gitattributes *.dat + git commit -m "first commit" + + # Verify that the pack code handles glob patterns properly. + git gc --aggressive --prune=now + + [ "Git LFS fsck OK" = "$(git lfs fsck)" ] +) +end_test + begin_test "fsck: outside git repository" ( set +e