Skip to content

Commit aac3eaa

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7e07d5 commit aac3eaa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

t/t1501-work-tree.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,12 @@ test_expect_success '$GIT_WORK_TREE overrides $GIT_DIR/common' '
423423
)
424424
'
425425

426+
test_expect_failure 'error out gracefully on invalid $GIT_WORK_TREE' '
427+
(
428+
GIT_WORK_TREE=/.invalid/work/tree &&
429+
export GIT_WORK_TREE &&
430+
test_expect_code 128 git rev-parse
431+
)
432+
'
433+
426434
test_done

0 commit comments

Comments
 (0)