X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diff-no-index.c;h=43aeeba2e0fd9c3c175dbc74a6f488e2c352c928;hb=78db709ae59da26de76264b79df3a7dc4d87e65c;hp=aae8e7accc1ff955bd76c62b379b37f343f61cc4;hpb=9eba92f684ad9fb1b2e9b99f3f406048fece266d;p=git.git diff --git a/diff-no-index.c b/diff-no-index.c index aae8e7acc..43aeeba2e 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -26,7 +26,7 @@ static int read_directory(const char *path, struct string_list *list) 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; @@ -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] != '/'))