@@ -4727,7 +4727,10 @@ void create_autostash_ref(struct repository *r, const char *refname,
47274727 create_autostash_internal (r , NULL , refname , message , silent );
47284728}
47294729
4730- static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply )
4730+ static int apply_save_autostash_oid (const char * stash_oid , int attempt_apply ,
4731+ const char * label_ours , const char * label_theirs ,
4732+ const char * label_base ,
4733+ const char * stash_msg )
47314734{
47324735 struct child_process child = CHILD_PROCESS_INIT ;
47334736 int ret = 0 ;
@@ -4738,6 +4741,12 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
47384741 child .no_stderr = 1 ;
47394742 strvec_push (& child .args , "stash" );
47404743 strvec_push (& child .args , "apply" );
4744+ if (label_ours )
4745+ strvec_pushf (& child .args , "--label-ours=%s" , label_ours );
4746+ if (label_theirs )
4747+ strvec_pushf (& child .args , "--label-theirs=%s" , label_theirs );
4748+ if (label_base )
4749+ strvec_pushf (& child .args , "--label-base=%s" , label_base );
47414750 strvec_push (& child .args , stash_oid );
47424751 ret = run_command (& child );
47434752 }
@@ -4751,7 +4760,7 @@ static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
47514760 strvec_push (& store .args , "stash" );
47524761 strvec_push (& store .args , "store" );
47534762 strvec_push (& store .args , "-m" );
4754- strvec_push (& store .args , "autostash" );
4763+ strvec_push (& store .args , stash_msg ? stash_msg : "autostash" );
47554764 strvec_push (& store .args , "-q" );
47564765 strvec_push (& store .args , stash_oid );
47574766 if (run_command (& store ))
@@ -4782,7 +4791,8 @@ static int apply_save_autostash(const char *path, int attempt_apply)
47824791 }
47834792 strbuf_trim (& stash_oid );
47844793
4785- ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply );
4794+ ret = apply_save_autostash_oid (stash_oid .buf , attempt_apply ,
4795+ NULL , NULL , NULL , NULL );
47864796
47874797 unlink (path );
47884798 strbuf_release (& stash_oid );
@@ -4801,11 +4811,14 @@ int apply_autostash(const char *path)
48014811
48024812int apply_autostash_oid (const char * stash_oid )
48034813{
4804- return apply_save_autostash_oid (stash_oid , 1 );
4814+ return apply_save_autostash_oid (stash_oid , 1 , NULL , NULL , NULL , NULL );
48054815}
48064816
48074817static int apply_save_autostash_ref (struct repository * r , const char * refname ,
4808- int attempt_apply )
4818+ int attempt_apply ,
4819+ const char * label_ours , const char * label_theirs ,
4820+ const char * label_base ,
4821+ const char * stash_msg )
48094822{
48104823 struct object_id stash_oid ;
48114824 char stash_oid_hex [GIT_MAX_HEXSZ + 1 ];
@@ -4821,7 +4834,9 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
48214834 return error (_ ("autostash reference is a symref" ));
48224835
48234836 oid_to_hex_r (stash_oid_hex , & stash_oid );
4824- 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 ,
4839+ stash_msg );
48254840
48264841 refs_delete_ref (get_main_ref_store (r ), "" , refname ,
48274842 & stash_oid , REF_NO_DEREF );
@@ -4831,12 +4846,17 @@ static int apply_save_autostash_ref(struct repository *r, const char *refname,
48314846
48324847int save_autostash_ref (struct repository * r , const char * refname )
48334848{
4834- return apply_save_autostash_ref (r , refname , 0 );
4849+ return apply_save_autostash_ref (r , refname , 0 ,
4850+ NULL , NULL , NULL , NULL );
48354851}
48364852
4837- int apply_autostash_ref (struct repository * r , const char * refname )
4853+ int apply_autostash_ref (struct repository * r , const char * refname ,
4854+ const char * label_ours , const char * label_theirs ,
4855+ const char * label_base , const char * stash_msg )
48384856{
4839- return apply_save_autostash_ref (r , refname , 1 );
4857+ return apply_save_autostash_ref (r , refname , 1 ,
4858+ label_ours , label_theirs , label_base ,
4859+ stash_msg );
48404860}
48414861
48424862static int checkout_onto (struct repository * r , struct replay_opts * opts ,
0 commit comments