@@ -4729,7 +4729,9 @@ void create_autostash_ref_silent(struct repository *r, const char *refname)
47294729 create_autostash_internal (r , NULL , refname , true);
47304730}
47314731
4732- static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply )
4732+ static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply ,
4733+ const char * label_ours , const char * label_theirs ,
4734+ const char * label_base )
47334735{
47344736 struct child_process child = CHILD_PROCESS_INIT ;
47354737 int ret = 0 ;
@@ -4740,6 +4742,12 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
47404742 child .no_stderr = 1 ;
47414743 strvec_push (& child .args , "stash" );
47424744 strvec_push (& child .args , "apply" );
4745+ if (label_ours )
4746+ strvec_pushf (& child .args , "--label-ours=%s" , label_ours );
4747+ if (label_theirs )
4748+ strvec_pushf (& child .args , "--label-theirs=%s" , label_theirs );
4749+ if (label_base )
4750+ strvec_pushf (& child .args , "--label-base=%s" , label_base );
47434751 strvec_push (& child .args , stash_oid );
47444752 ret = run_command (& child );
47454753 }
@@ -4784,7 +4792,8 @@ static int apply_save_autostash(const char *path, int attempt_apply)
47844792 }
47854793 strbuf_trim (& stash_oid );
47864794
4787- ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply );
4795+ ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply ,
4796+ NULL , NULL , NULL );
47884797
47894798 unlink (path );
47904799 strbuf_release (& stash_oid );
@@ -4803,11 +4812,13 @@ int apply_autostash(const char *path)
48034812
48044813int apply_autostash_oid (const char * stash_oid )
48054814{
4806- return apply_save_autostash_oid (stash_oid , 1 );
4815+ return apply_save_autostash_oid (stash_oid , 1 , NULL , NULL , NULL );
48074816}
48084817
48094818static int apply_save_autostash_ref (struct repository * r , const char * refname ,
4810- int attempt_apply )
4819+ int attempt_apply ,
4820+ const char * label_ours , const char * label_theirs ,
4821+ const char * label_base )
48114822{
48124823 struct object_id stash_oid ;
48134824 char stash_oid_hex [GIT_MAX_HEXSZ + 1 ];
@@ -4823,7 +4834,8 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
48234834 return error (_ ("autostash reference is a symref" ));
48244835
48254836 oid_to_hex_r (stash_oid_hex , & stash_oid );
4826- ret = apply_save_autostash_oid (stash_oid_hex , attempt_apply );
4837+ ret = apply_save_autostash_oid (stash_oid_hex , attempt_apply ,
4838+ label_ours , label_theirs , label_base );
48274839
48284840 refs_delete_ref (get_main_ref_store (r ), "" , refname ,
48294841 & stash_oid , REF_NO_DEREF );
@@ -4833,12 +4845,20 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
48334845
48344846int save_autostash_ref (struct repository * r , const char * refname )
48354847{
4836- return apply_save_autostash_ref (r , refname , 0 );
4848+ return apply_save_autostash_ref (r , refname , 0 , NULL , NULL , NULL );
48374849}
48384850
48394851int apply_autostash_ref (struct repository * r , const char * refname )
48404852{
4841- return apply_save_autostash_ref (r , refname , 1 );
4853+ return apply_save_autostash_ref (r , refname , 1 , NULL , NULL , NULL );
4854+ }
4855+
4856+ int apply_autostash_ref_with_labels (struct repository * r , const char * refname ,
4857+ const char * label_ours , const char * label_theirs ,
4858+ const char * label_base )
4859+ {
4860+ return apply_save_autostash_ref (r , refname , 1 ,
4861+ label_ours , label_theirs , label_base );
48424862}
48434863
48444864static int checkout_onto (struct repository * r , struct replay_opts * opts ,
0 commit comments