@@ -2343,6 +2343,12 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
2343
2343
2344
2344
CALLOC_ARRAY (ref -> value , used_atom_cnt );
2345
2345
2346
+ /**
2347
+ * NEEDSWORK: The following code might be unncessary if all codepaths
2348
+ * that call populate_value() populates the symref member of ref_array_item
2349
+ * like in apply_ref_filter(). Currently pretty_print_ref() is the only codepath
2350
+ * that calls populate_value() without first populating symref.
2351
+ */
2346
2352
if (need_symref && (ref -> flag & REF_ISSYMREF ) && !ref -> symref ) {
2347
2353
ref -> symref = refs_resolve_refdup (get_main_ref_store (the_repository ),
2348
2354
ref -> refname ,
@@ -2783,7 +2789,7 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)
2783
2789
return ref_kind_from_refname (refname );
2784
2790
}
2785
2791
2786
- static struct ref_array_item * apply_ref_filter (const char * refname , const struct object_id * oid ,
2792
+ static struct ref_array_item * apply_ref_filter (const char * refname , const char * referent , const struct object_id * oid ,
2787
2793
int flag , struct ref_filter * filter )
2788
2794
{
2789
2795
struct ref_array_item * ref ;
@@ -2852,6 +2858,7 @@ static struct ref_array_item *apply_ref_filter(const char *refname, const struct
2852
2858
ref -> commit = commit ;
2853
2859
ref -> flag = flag ;
2854
2860
ref -> kind = kind ;
2861
+ ref -> symref = xstrdup_or_null (referent );
2855
2862
2856
2863
return ref ;
2857
2864
}
@@ -2865,12 +2872,12 @@ struct ref_filter_cbdata {
2865
2872
* A call-back given to for_each_ref(). Filter refs and keep them for
2866
2873
* later object processing.
2867
2874
*/
2868
- static int filter_one (const char * refname , const char * referent UNUSED , const struct object_id * oid , int flag , void * cb_data )
2875
+ static int filter_one (const char * refname , const char * referent , const struct object_id * oid , int flag , void * cb_data )
2869
2876
{
2870
2877
struct ref_filter_cbdata * ref_cbdata = cb_data ;
2871
2878
struct ref_array_item * ref ;
2872
2879
2873
- ref = apply_ref_filter (refname , oid , flag , ref_cbdata -> filter );
2880
+ ref = apply_ref_filter (refname , referent , oid , flag , ref_cbdata -> filter );
2874
2881
if (ref )
2875
2882
ref_array_append (ref_cbdata -> array , ref );
2876
2883
@@ -2900,13 +2907,13 @@ struct ref_filter_and_format_cbdata {
2900
2907
} internal ;
2901
2908
};
2902
2909
2903
- static int filter_and_format_one (const char * refname , const char * referent UNUSED , const struct object_id * oid , int flag , void * cb_data )
2910
+ static int filter_and_format_one (const char * refname , const char * referent , const struct object_id * oid , int flag , void * cb_data )
2904
2911
{
2905
2912
struct ref_filter_and_format_cbdata * ref_cbdata = cb_data ;
2906
2913
struct ref_array_item * ref ;
2907
2914
struct strbuf output = STRBUF_INIT , err = STRBUF_INIT ;
2908
2915
2909
- ref = apply_ref_filter (refname , oid , flag , ref_cbdata -> filter );
2916
+ ref = apply_ref_filter (refname , referent , oid , flag , ref_cbdata -> filter );
2910
2917
if (!ref )
2911
2918
return 0 ;
2912
2919
0 commit comments