From aac3eaa6242d00d358a077aa740cf5051905a569 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 8 Mar 2017 16:43:34 +0100 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- t/t1501-work-tree.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh index cc5b870e58..046d9b7909 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 -- 2.11.4.GIT