@@ -96,6 +96,14 @@ static void show(const char *arg)
96
96
puts (arg );
97
97
}
98
98
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
+
99
107
/* Output a revision, only if filter allows it */
100
108
static void show_rev (int type , const unsigned char * sha1 , const char * name )
101
109
{
@@ -104,8 +112,6 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
104
112
def = NULL ;
105
113
revs_count ++ ;
106
114
107
- if (type != show_type )
108
- putchar ('^' );
109
115
if (symbolic && name ) {
110
116
if (symbolic == SHOW_SYMBOLIC_FULL ) {
111
117
unsigned char discard [20 ];
@@ -122,20 +128,20 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
122
128
*/
123
129
break ;
124
130
case 1 : /* happy */
125
- show ( full );
131
+ show_with_type ( type , full );
126
132
break ;
127
133
default : /* ambiguous */
128
134
error ("refname '%s' is ambiguous" , name );
129
135
break ;
130
136
}
131
137
} else {
132
- show ( name );
138
+ show_with_type ( type , name );
133
139
}
134
140
}
135
141
else if (abbrev )
136
- show ( find_unique_abbrev (sha1 , abbrev ));
142
+ show_with_type ( type , find_unique_abbrev (sha1 , abbrev ));
137
143
else
138
- show ( sha1_to_hex (sha1 ));
144
+ show_with_type ( type , sha1_to_hex (sha1 ));
139
145
}
140
146
141
147
/* Output a flag, only if filter allows it. */
0 commit comments