@@ -5819,7 +5819,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
58195819 int root_with_onto = flags & TODO_LIST_ROOT_WITH_ONTO ;
58205820 int skipped_commit = 0 ;
58215821 struct strbuf buf = STRBUF_INIT , oneline = STRBUF_INIT ;
5822- struct strbuf label = STRBUF_INIT ;
5822+ struct strbuf label_from_message = STRBUF_INIT ;
58235823 struct commit_list * commits = NULL , * * tail = & commits , * iter ;
58245824 struct commit_list * tips = NULL , * * tips_tail = & tips ;
58255825 struct commit * commit ;
@@ -5842,6 +5842,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
58425842 oidmap_init (& state .commit2label , 0 );
58435843 hashmap_init (& state .labels , labels_cmp , NULL , 0 );
58445844 strbuf_init (& state .buf , 32 );
5845+ load_branch_decorations ();
58455846
58465847 if (revs -> cmdline .nr && (revs -> cmdline .rev [0 ].flags & BOTTOM )) {
58475848 struct labels_entry * onto_label_entry ;
@@ -5902,25 +5903,33 @@ static int make_script_with_merges(struct pretty_print_context *pp,
59025903 continue ;
59035904 }
59045905
5905- /* Create a label */
5906- strbuf_reset (& label );
5906+ /* Create a label from the commit message */
5907+ strbuf_reset (& label_from_message );
59075908 if (skip_prefix (oneline .buf , "Merge " , & p1 ) &&
59085909 (p1 = strchr (p1 , '\'' )) &&
59095910 (p2 = strchr (++ p1 , '\'' )))
5910- strbuf_add (& label , p1 , p2 - p1 );
5911+ strbuf_add (& label_from_message , p1 , p2 - p1 );
59115912 else if (skip_prefix (oneline .buf , "Merge pull request " ,
59125913 & p1 ) &&
59135914 (p1 = strstr (p1 , " from " )))
5914- strbuf_addstr (& label , p1 + strlen (" from " ));
5915+ strbuf_addstr (& label_from_message , p1 + strlen (" from " ));
59155916 else
5916- strbuf_addbuf (& label , & oneline );
5917+ strbuf_addbuf (& label_from_message , & oneline );
59175918
59185919 strbuf_reset (& buf );
59195920 strbuf_addf (& buf , "%s -C %s" ,
59205921 cmd_merge , oid_to_hex (& commit -> object .oid ));
59215922
59225923 /* label the tips of merged branches */
59235924 for (; to_merge ; to_merge = to_merge -> next ) {
5925+ const char * label = label_from_message .buf ;
5926+ const struct name_decoration * decoration =
5927+ get_name_decoration (& to_merge -> item -> object );
5928+
5929+ if (decoration )
5930+ skip_prefix (decoration -> name , "refs/heads/" ,
5931+ & label );
5932+
59245933 oid = & to_merge -> item -> object .oid ;
59255934 strbuf_addch (& buf , ' ' );
59265935
@@ -5933,7 +5942,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
59335942 tips_tail = & commit_list_insert (to_merge -> item ,
59345943 tips_tail )-> next ;
59355944
5936- strbuf_addstr (& buf , label_oid (oid , label . buf , & state ));
5945+ strbuf_addstr (& buf , label_oid (oid , label , & state ));
59375946 }
59385947 strbuf_addf (& buf , " # %s" , oneline .buf );
59395948
@@ -6041,7 +6050,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
60416050 free_commit_list (commits );
60426051 free_commit_list (tips );
60436052
6044- strbuf_release (& label );
6053+ strbuf_release (& label_from_message );
60456054 strbuf_release (& oneline );
60466055 strbuf_release (& buf );
60476056
@@ -6403,14 +6412,6 @@ static int add_decorations_to_list(const struct commit *commit,
64036412static int todo_list_add_update_ref_commands (struct todo_list * todo_list )
64046413{
64056414 int i , res ;
6406- static struct string_list decorate_refs_exclude = STRING_LIST_INIT_NODUP ;
6407- static struct string_list decorate_refs_exclude_config = STRING_LIST_INIT_NODUP ;
6408- static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP ;
6409- struct decoration_filter decoration_filter = {
6410- .include_ref_pattern = & decorate_refs_include ,
6411- .exclude_ref_pattern = & decorate_refs_exclude ,
6412- .exclude_ref_config_pattern = & decorate_refs_exclude_config ,
6413- };
64146415 struct todo_add_branch_context ctx = {
64156416 .buf = & todo_list -> buf ,
64166417 .refs_to_oids = STRING_LIST_INIT_DUP ,
@@ -6419,8 +6420,7 @@ static int todo_list_add_update_ref_commands(struct todo_list *todo_list)
64196420 ctx .items_alloc = 2 * todo_list -> nr + 1 ;
64206421 ALLOC_ARRAY (ctx .items , ctx .items_alloc );
64216422
6422- string_list_append (& decorate_refs_include , "refs/heads/" );
6423- load_ref_decorations (& decoration_filter , 0 );
6423+ load_branch_decorations ();
64246424
64256425 for (i = 0 ; i < todo_list -> nr ; ) {
64266426 struct todo_item * item = & todo_list -> items [i ];
0 commit comments