@@ -4704,7 +4704,9 @@ void create_autostash_ref_silent(struct repository *r, const char *refname)
47044704 create_autostash_internal (r , NULL , refname , 1 );
47054705}
47064706
4707- static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply )
4707+ static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply ,
4708+ const char * label1 , const char * label2 ,
4709+ const char * label_ancestor )
47084710{
47094711 struct child_process child = CHILD_PROCESS_INIT ;
47104712 int ret = 0 ;
@@ -4715,6 +4717,12 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
47154717 child .no_stderr = 1 ;
47164718 strvec_push (& child .args , "stash" );
47174719 strvec_push (& child .args , "apply" );
4720+ if (label1 )
4721+ strvec_pushf (& child .args , "--ours-label=%s" , label1 );
4722+ if (label2 )
4723+ strvec_pushf (& child .args , "--theirs-label=%s" , label2 );
4724+ if (label_ancestor )
4725+ strvec_pushf (& child .args , "--base-label=%s" , label_ancestor );
47184726 strvec_push (& child .args , stash_oid );
47194727 ret = run_command (& child );
47204728 }
@@ -4759,7 +4767,8 @@ static int apply_save_autostash(const char *path, int attempt_apply)
47594767 }
47604768 strbuf_trim (& stash_oid );
47614769
4762- ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply );
4770+ ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply ,
4771+ NULL , NULL , NULL );
47634772
47644773 unlink (path );
47654774 strbuf_release (& stash_oid );
@@ -4778,11 +4787,13 @@ int apply_autostash(const char *path)
47784787
47794788int apply_autostash_oid (const char * stash_oid )
47804789{
4781- return apply_save_autostash_oid (stash_oid , 1 );
4790+ return apply_save_autostash_oid (stash_oid , 1 , NULL , NULL , NULL );
47824791}
47834792
47844793static int apply_save_autostash_ref (struct repository * r , const char * refname ,
4785- int attempt_apply )
4794+ int attempt_apply ,
4795+ const char * label1 , const char * label2 ,
4796+ const char * label_ancestor )
47864797{
47874798 struct object_id stash_oid ;
47884799 char stash_oid_hex [GIT_MAX_HEXSZ + 1 ];
@@ -4798,7 +4809,8 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
47984809 return error (_ ("autostash reference is a symref" ));
47994810
48004811 oid_to_hex_r (stash_oid_hex , & stash_oid );
4801- ret = apply_save_autostash_oid (stash_oid_hex , attempt_apply );
4812+ ret = apply_save_autostash_oid (stash_oid_hex , attempt_apply ,
4813+ label1 , label2 , label_ancestor );
48024814
48034815 refs_delete_ref (get_main_ref_store (r ), "" , refname ,
48044816 & stash_oid , REF_NO_DEREF );
@@ -4808,12 +4820,20 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
48084820
48094821int save_autostash_ref (struct repository * r , const char * refname )
48104822{
4811- return apply_save_autostash_ref (r , refname , 0 );
4823+ return apply_save_autostash_ref (r , refname , 0 , NULL , NULL , NULL );
48124824}
48134825
48144826int apply_autostash_ref (struct repository * r , const char * refname )
48154827{
4816- return apply_save_autostash_ref (r , refname , 1 );
4828+ return apply_save_autostash_ref (r , refname , 1 , NULL , NULL , NULL );
4829+ }
4830+
4831+ int apply_autostash_ref_with_labels (struct repository * r , const char * refname ,
4832+ const char * label1 , const char * label2 ,
4833+ const char * label_ancestor )
4834+ {
4835+ return apply_save_autostash_ref (r , refname , 1 ,
4836+ label1 , label2 , label_ancestor );
48174837}
48184838
48194839static int checkout_onto (struct repository * r , struct replay_opts * opts ,
0 commit comments