X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diff-no-index.c;h=43aeeba2e0fd9c3c175dbc74a6f488e2c352c928;hb=c7e375de4228cdb86e2582e2eda7fa3a6f352fc2;hp=4ebc1dbd87d9b90ad2aaa5c7d4601761e2d1d724;hpb=011c181cc656c8b3e48882729d1b6238e8c5c537;p=git.git diff --git a/diff-no-index.c b/diff-no-index.c index 4ebc1dbd8..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] != '/')) @@ -201,8 +199,8 @@ void diff_no_index(struct rev_info *revs, return; } if (argc != i + 2) - die("git diff %s takes two paths", - no_index ? "--no-index" : "[--no-index]"); + usagef("git diff %s ", + no_index ? "--no-index" : "[--no-index]"); diff_setup(&revs->diffopt); for (i = 1; i < argc - 2; ) {