File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ static int print_paths(ls_options *opts, git_index *index)
8383{
8484 size_t i ;
8585 const git_index_entry * entry ;
86-
86+
8787 /* if there are not files explicitly listed by the user print all entries in the index */
8888 if (opts -> file_count == 0 ) {
8989 size_t entry_count = git_index_entrycount (index );
@@ -99,14 +99,13 @@ static int print_paths(ls_options *opts, git_index *index)
9999 for (i = 0 ; i < opts -> file_count ; ++ i ) {
100100 const char * path = opts -> files [i ];
101101
102- entry = git_index_get_bypath (index , path , GIT_INDEX_STAGE_NORMAL );
103- if (!entry && opts -> error_unmatch ) {
102+ if ((entry = git_index_get_bypath (index , path , GIT_INDEX_STAGE_NORMAL )) != NULL ) {
103+ printf ("%s\n" , path );
104+ } else if (opts -> error_unmatch ) {
104105 fprintf (stderr , "error: pathspec '%s' did not match any file(s) known to git.\n" , path );
105106 fprintf (stderr , "Did you forget to 'git add'?\n" );
106107 return -1 ;
107108 }
108-
109- printf ("%s\n" , path );
110109 }
111110
112111 return 0 ;
You can’t perform that action at this time.
0 commit comments