diff --git a/diff-no-index.c b/diff-no-index.c
index aae8e7accc1ff955bd76c62b379b37f343f61cc4..43aeeba2e0fd9c3c175dbc74a6f488e2c352c928 100644 (file)
--- a/diff-no-index.c
+++ b/diff-no-index.c
while ((e = readdir(dir)))
if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
- string_list_insert(e->d_name, list);
+ string_list_insert(list, e->d_name);
closedir(dir);
return 0;
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] != '/'))