@@ -94,6 +94,8 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
94
94
struct object * obj ;
95
95
enum decoration_type type = DECORATION_NONE ;
96
96
97
+ assert (cb_data == NULL );
98
+
97
99
if (starts_with (refname , "refs/replace/" )) {
98
100
unsigned char original_sha1 [20 ];
99
101
if (!check_replace_refs )
@@ -123,8 +125,6 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
123
125
else if (!strcmp (refname , "HEAD" ))
124
126
type = DECORATION_REF_HEAD ;
125
127
126
- if (!cb_data || * (int * )cb_data == DECORATE_SHORT_REFS )
127
- refname = prettify_refname (refname );
128
128
add_name_decoration (type , refname , obj );
129
129
while (obj -> type == OBJ_TAG ) {
130
130
obj = ((struct tag * )obj )-> tagged ;
@@ -151,8 +151,8 @@ void load_ref_decorations(int flags)
151
151
if (!decoration_loaded ) {
152
152
decoration_loaded = 1 ;
153
153
decoration_flags = flags ;
154
- for_each_ref (add_ref_decoration , & flags );
155
- head_ref (add_ref_decoration , & flags );
154
+ for_each_ref (add_ref_decoration , NULL );
155
+ head_ref (add_ref_decoration , NULL );
156
156
for_each_commit_graft (add_graft_decoration , NULL );
157
157
}
158
158
}
@@ -199,18 +199,8 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d
199
199
if (!(rru_flags & REF_ISSYMREF ))
200
200
return NULL ;
201
201
202
- if ((decoration_flags == DECORATE_SHORT_REFS )) {
203
- if (!skip_prefix (branch_name , "refs/heads/" , & branch_name ))
204
- return NULL ;
205
- } else {
206
- /*
207
- * Each decoration has a refname in full; keep
208
- * branch_name also in full, but still make sure
209
- * HEAD is a reasonable ref.
210
- */
211
- if (!starts_with (branch_name , "refs/" ))
212
- return NULL ;
213
- }
202
+ if (!starts_with (branch_name , "refs/" ))
203
+ return NULL ;
214
204
215
205
/* OK, do we have that ref in the list? */
216
206
for (list = decoration ; list ; list = list -> next )
@@ -222,6 +212,14 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d
222
212
return NULL ;
223
213
}
224
214
215
+ static void show_name (struct strbuf * sb , const struct name_decoration * decoration )
216
+ {
217
+ if (decoration_flags == DECORATE_SHORT_REFS )
218
+ strbuf_addstr (sb , prettify_refname (decoration -> name ));
219
+ else
220
+ strbuf_addstr (sb , decoration -> name );
221
+ }
222
+
225
223
/*
226
224
* The caller makes sure there is no funny color before calling.
227
225
* format_decorations_extended makes sure the same after return.
@@ -259,7 +257,7 @@ void format_decorations_extended(struct strbuf *sb,
259
257
if (decoration -> type == DECORATION_REF_TAG )
260
258
strbuf_addstr (sb , "tag: " );
261
259
262
- strbuf_addstr (sb , decoration -> name );
260
+ show_name (sb , decoration );
263
261
264
262
if (current_and_HEAD &&
265
263
decoration -> type == DECORATION_REF_HEAD ) {
@@ -268,7 +266,7 @@ void format_decorations_extended(struct strbuf *sb,
268
266
strbuf_addstr (sb , " -> " );
269
267
strbuf_addstr (sb , color_reset );
270
268
strbuf_addstr (sb , decorate_get_color (use_color , current_and_HEAD -> type ));
271
- strbuf_addstr (sb , current_and_HEAD -> name );
269
+ show_name (sb , current_and_HEAD );
272
270
}
273
271
strbuf_addstr (sb , color_reset );
274
272
0 commit comments