summaryrefslogtreecommitdiff
path: root/diff-no-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff-no-index.c')
-rw-r--r--diff-no-index.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/diff-no-index.c b/diff-no-index.c
index aae8e7a..4cd9dac 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -150,16 +150,14 @@ static int queue_diff(struct diff_options *o,
static int path_outside_repo(const char *path)
{
- /*
- * We have already done setup_git_directory_gently() so we
- * know we are inside a git work tree already.
- */
const char *work_tree;
size_t len;
if (!is_absolute_path(path))
return 0;
work_tree = get_git_work_tree();
+ if (!work_tree)
+ return 1;
len = strlen(work_tree);
if (strncmp(path, work_tree, len) ||
(path[len] != '\0' && path[len] != '/'))