@@ -96,6 +96,14 @@ static void show(const char *arg)
9696 puts (arg );
9797}
9898
99+ /* Like show(), but with a negation prefix according to type */
100+ static void show_with_type (int type , const char * arg )
101+ {
102+ if (type != show_type )
103+ putchar ('^' );
104+ show (arg );
105+ }
106+
99107/* Output a revision, only if filter allows it */
100108static void show_rev (int type , const unsigned char * sha1 , const char * name )
101109{
@@ -104,8 +112,6 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
104112 def = NULL ;
105113 revs_count ++ ;
106114
107- if (type != show_type )
108- putchar ('^' );
109115 if (symbolic && name ) {
110116 if (symbolic == SHOW_SYMBOLIC_FULL ) {
111117 unsigned char discard [20 ];
@@ -122,20 +128,20 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
122128 */
123129 break ;
124130 case 1 : /* happy */
125- show ( full );
131+ show_with_type ( type , full );
126132 break ;
127133 default : /* ambiguous */
128134 error ("refname '%s' is ambiguous" , name );
129135 break ;
130136 }
131137 } else {
132- show ( name );
138+ show_with_type ( type , name );
133139 }
134140 }
135141 else if (abbrev )
136- show ( find_unique_abbrev (sha1 , abbrev ));
142+ show_with_type ( type , find_unique_abbrev (sha1 , abbrev ));
137143 else
138- show ( sha1_to_hex (sha1 ));
144+ show_with_type ( type , sha1_to_hex (sha1 ));
139145}
140146
141147/* Output a flag, only if filter allows it. */
0 commit comments