@@ -772,6 +772,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
772
772
struct oid_array merge_heads = OID_ARRAY_INIT ;
773
773
struct object_id orig_head , curr_head ;
774
774
struct object_id rebase_fork_point ;
775
+ int autostash ;
775
776
776
777
if (!getenv ("GIT_REFLOG_ACTION" ))
777
778
set_reflog_message (argc , argv );
@@ -800,8 +801,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
800
801
if (!opt_rebase && opt_autostash != -1 )
801
802
die (_ ("--[no-]autostash option is only valid with --rebase." ));
802
803
804
+ autostash = config_autostash ;
803
805
if (opt_rebase ) {
804
- int autostash = config_autostash ;
805
806
if (opt_autostash != -1 )
806
807
autostash = opt_autostash ;
807
808
@@ -862,16 +863,18 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
862
863
die (_ ("Cannot rebase onto multiple branches." ));
863
864
864
865
if (opt_rebase ) {
865
- struct commit_list * list = NULL ;
866
- struct commit * merge_head , * head ;
867
-
868
- head = lookup_commit_reference (& orig_head );
869
- commit_list_insert (head , & list );
870
- merge_head = lookup_commit_reference (& merge_heads .oid [0 ]);
871
- if (is_descendant_of (merge_head , list )) {
872
- /* we can fast-forward this without invoking rebase */
873
- opt_ff = "--ff-only" ;
874
- return run_merge ();
866
+ if (!autostash ) {
867
+ struct commit_list * list = NULL ;
868
+ struct commit * merge_head , * head ;
869
+
870
+ head = lookup_commit_reference (& orig_head );
871
+ commit_list_insert (head , & list );
872
+ merge_head = lookup_commit_reference (& merge_heads .oid [0 ]);
873
+ if (is_descendant_of (merge_head , list )) {
874
+ /* we can fast-forward this without invoking rebase */
875
+ opt_ff = "--ff-only" ;
876
+ return run_merge ();
877
+ }
875
878
}
876
879
return run_rebase (& curr_head , merge_heads .oid , & rebase_fork_point );
877
880
} else {
0 commit comments