File tree Expand file tree Collapse file tree 6 files changed +38
-1
lines changed
Expand file tree Collapse file tree 6 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,14 @@ int main(int argc, const char **argv)
223223 diff_output_format = DIFF_FORMAT_MACHINE ;
224224 continue ;
225225 }
226+ if (!strcmp (arg , "--name-only" )) {
227+ diff_output_format = DIFF_FORMAT_NAME ;
228+ continue ;
229+ }
230+ if (!strcmp (arg , "--name-only-z" )) {
231+ diff_output_format = DIFF_FORMAT_NAME_Z ;
232+ continue ;
233+ }
226234 if (!strcmp (arg , "-R" )) {
227235 diff_setup_opt |= DIFF_SETUP_REVERSE ;
228236 continue ;
Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ int main(int argc, const char **argv)
5555 ; /* no-op */
5656 else if (!strcmp (argv [1 ], "-z" ))
5757 diff_output_format = DIFF_FORMAT_MACHINE ;
58+ else if (!strcmp (argv [1 ], "--name-only" ))
59+ diff_output_format = DIFF_FORMAT_NAME ;
60+ else if (!strcmp (argv [1 ], "--name-only-z" ))
61+ diff_output_format = DIFF_FORMAT_NAME_Z ;
5862 else if (!strcmp (argv [1 ], "-R" ))
5963 diff_setup_opt |= DIFF_SETUP_REVERSE ;
6064 else if (!strncmp (argv [1 ], "-S" , 2 ))
Original file line number Diff line number Diff line change @@ -87,6 +87,10 @@ int main(int ac, const char **av)
8787 find_copies_harder = 1 ;
8888 else if (!strcmp (arg , "-z" ))
8989 diff_output_format = DIFF_FORMAT_MACHINE ;
90+ else if (!strcmp (arg , "--name-only" ))
91+ diff_output_format = DIFF_FORMAT_NAME ;
92+ else if (!strcmp (arg , "--name-only-z" ))
93+ diff_output_format = DIFF_FORMAT_NAME_Z ;
9094 else if (!strcmp (arg , "-R" ))
9195 diff_setup_opt |= DIFF_SETUP_REVERSE ;
9296 else if (!strncmp (arg , "-S" , 2 ))
Original file line number Diff line number Diff line change @@ -480,6 +480,14 @@ int main(int argc, const char **argv)
480480 find_copies_harder = 1 ;
481481 continue ;
482482 }
483+ if (!strcmp (arg , "--name-only" )) {
484+ diff_output_format = DIFF_FORMAT_NAME ;
485+ continue ;
486+ }
487+ if (!strcmp (arg , "--name-only-z" )) {
488+ diff_output_format = DIFF_FORMAT_NAME_Z ;
489+ continue ;
490+ }
483491 if (!strcmp (arg , "-z" )) {
484492 diff_output_format = DIFF_FORMAT_MACHINE ;
485493 continue ;
Original file line number Diff line number Diff line change @@ -818,6 +818,12 @@ static void diff_flush_raw(struct diff_filepair *p,
818818 putchar (line_termination );
819819}
820820
821+ static void diff_flush_name (struct diff_filepair * p ,
822+ int line_termination )
823+ {
824+ printf ("%s%c" , p -> two -> path , line_termination );
825+ }
826+
821827int diff_unmodified_pair (struct diff_filepair * p )
822828{
823829 /* This function is written stricter than necessary to support
@@ -978,7 +984,8 @@ void diff_flush(int diff_output_style)
978984 int line_termination = '\n' ;
979985 int inter_name_termination = '\t' ;
980986
981- if (diff_output_style == DIFF_FORMAT_MACHINE )
987+ if (diff_output_style == DIFF_FORMAT_MACHINE ||
988+ diff_output_style == DIFF_FORMAT_NAME_Z )
982989 line_termination = inter_name_termination = 0 ;
983990
984991 for (i = 0 ; i < q -> nr ; i ++ ) {
@@ -997,6 +1004,10 @@ void diff_flush(int diff_output_style)
9971004 diff_flush_raw (p , line_termination ,
9981005 inter_name_termination );
9991006 break ;
1007+ case DIFF_FORMAT_NAME :
1008+ case DIFF_FORMAT_NAME_Z :
1009+ diff_flush_name (p , line_termination );
1010+ break ;
10001011 }
10011012 }
10021013 for (i = 0 ; i < q -> nr ; i ++ )
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ extern int diff_queue_is_empty(void);
5959#define DIFF_FORMAT_MACHINE 1
6060#define DIFF_FORMAT_PATCH 2
6161#define DIFF_FORMAT_NO_OUTPUT 3
62+ #define DIFF_FORMAT_NAME 4
63+ #define DIFF_FORMAT_NAME_Z 5
6264
6365extern void diff_flush (int output_style );
6466
You can’t perform that action at this time.
0 commit comments