summaryrefslogtreecommitdiff
path: root/t/t1501-work-tree.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-03-08 15:43:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-08 22:38:22 (GMT)
commitaac3eaa6242d00d358a077aa740cf5051905a569 (patch)
tree10549d3a1dd30d8f40b5659a644a85ae93832cd7 /t/t1501-work-tree.sh
parente7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7 (diff)
downloadgit-aac3eaa6242d00d358a077aa740cf5051905a569.zip
git-aac3eaa6242d00d358a077aa740cf5051905a569.tar.gz
git-aac3eaa6242d00d358a077aa740cf5051905a569.tar.bz2
t1501: demonstrate NULL pointer access with invalid GIT_WORK_TREE
When GIT_WORK_TREE does not specify a valid path, we should error out, instead of crashing. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1501-work-tree.sh')
-rwxr-xr-xt/t1501-work-tree.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index cc5b870..046d9b7 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -423,4 +423,12 @@ test_expect_success '$GIT_WORK_TREE overrides $GIT_DIR/common' '
)
'
+test_expect_failure 'error out gracefully on invalid $GIT_WORK_TREE' '
+ (
+ GIT_WORK_TREE=/.invalid/work/tree &&
+ export GIT_WORK_TREE &&
+ test_expect_code 128 git rev-parse
+ )
+'
+
test_done