@@ -346,29 +346,33 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
346346 }
347347}
348348
349- int report_path_error (const char * ps_matched , const char * * pathspec , const char * prefix )
349+ int report_path_error (const char * ps_matched ,
350+ const struct pathspec * pathspec ,
351+ const char * prefix )
350352{
351353 /*
352354 * Make sure all pathspec matched; otherwise it is an error.
353355 */
354356 struct strbuf sb = STRBUF_INIT ;
355- const char * name ;
356357 int num , errors = 0 ;
357- for (num = 0 ; pathspec [ num ] ; num ++ ) {
358+ for (num = 0 ; num < pathspec -> nr ; num ++ ) {
358359 int other , found_dup ;
359360
360361 if (ps_matched [num ])
361362 continue ;
362363 /*
363364 * The caller might have fed identical pathspec
364365 * twice. Do not barf on such a mistake.
366+ * FIXME: parse_pathspec should have eliminated
367+ * duplicate pathspec.
365368 */
366369 for (found_dup = other = 0 ;
367- !found_dup && pathspec [ other ] ;
370+ !found_dup && other < pathspec -> nr ;
368371 other ++ ) {
369372 if (other == num || !ps_matched [other ])
370373 continue ;
371- if (!strcmp (pathspec [other ], pathspec [num ]))
374+ if (!strcmp (pathspec -> items [other ].original ,
375+ pathspec -> items [num ].original ))
372376 /*
373377 * Ok, we have a match already.
374378 */
@@ -377,9 +381,8 @@ int report_path_error(const char *ps_matched, const char **pathspec, const char
377381 if (found_dup )
378382 continue ;
379383
380- name = quote_path_relative (pathspec [num ], -1 , & sb , prefix );
381384 error ("pathspec '%s' did not match any file(s) known to git." ,
382- name );
385+ pathspec -> items [ num ]. original );
383386 errors ++ ;
384387 }
385388 strbuf_release (& sb );
@@ -575,7 +578,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
575578
576579 if (ps_matched ) {
577580 int bad ;
578- bad = report_path_error (ps_matched , pathspec . raw , prefix );
581+ bad = report_path_error (ps_matched , & pathspec , prefix );
579582 if (bad )
580583 fprintf (stderr , "Did you forget to 'git add'?\n" );
581584
0 commit comments