983
984
cmd.git_cmd = 1;
985
986
- if (is_rebase_i(opts) && read_env_script(&cmd.env_array)) {
986
+ if (is_rebase_i(opts) && !(!defmsg && (flags & AMEND_MSG)) &&
987
+ read_env_script(&cmd.env_array)) {
988
const char *gpg_opt = gpg_sign_opt_quoted(opts);
989
990
return error(_(staged_changes_advice),
3816
goto leave_merge;
3817
}
3818
3819
+ /*
3820
+ * If HEAD is not identical to the first parent of the original merge
3821
+ * commit, we cannot fast-forward.
3822
+ */
3823
+ can_fast_forward = opts->allow_ff && commit && commit->parents &&
3824
+ oideq(&commit->parents->item->object.oid,
3825
+ &head_commit->object.oid);
3826
+
3827
+ /*
3828
+ * If any merge head is different from the original one, we cannot
3829
+ * fast-forward.
3830
+ */
3831
+ if (can_fast_forward) {
3832
+ struct commit_list *p = commit->parents->next;
3833
+
3834
+ for (j = to_merge; j && p; j = j->next, p = p->next)
3835
+ if (!oideq(&j->item->object.oid,
3836
+ &p->item->object.oid)) {
3837
+ can_fast_forward = 0;
3838
+ break;
3839
+ }
3840
+ /*
3841
+ * If the number of merge heads differs from the original merge
3842
+ * commit, we cannot fast-forward.
3843
+ */
3844
+ if (j || p)
3845
+ can_fast_forward = 0;
3846
+ }
3847
+
3848
+ if (can_fast_forward) {
3849
+ rollback_lock_file(&lock);
3850
+ ret = fast_forward_to(r, &commit->object.oid,
3851
+ &head_commit->object.oid, 0, opts);
3852
+ if (flags & TODO_EDIT_MERGE_MSG)
3853
+ goto fast_forward_edit;
3854
+
3855
+ goto leave_merge;
3856
+ }
3857
+
3858
if (commit) {
3859
const char *encoding = get_commit_output_encoding();
3860
const char *message = logmsg_reencode(commit, NULL, encoding);
3904
}
3905
}
3906
3867
- /*
3868
- * If HEAD is not identical to the first parent of the original merge
3869
- * commit, we cannot fast-forward.
3870
- */
3871
- can_fast_forward = opts->allow_ff && commit && commit->parents &&
3872
- oideq(&commit->parents->item->object.oid,
3873
- &head_commit->object.oid);
3874
-
3875
- /*
3876
- * If any merge head is different from the original one, we cannot
3877
- * fast-forward.
3878
- */
3879
- if (can_fast_forward) {
3880
- struct commit_list *p = commit->parents->next;
3881
-
3882
- for (j = to_merge; j && p; j = j->next, p = p->next)
3883
- if (!oideq(&j->item->object.oid,
3884
- &p->item->object.oid)) {
3885
- can_fast_forward = 0;
3886
- break;
3887
- }
3888
- /*
3889
- * If the number of merge heads differs from the original merge
3890
- * commit, we cannot fast-forward.
3891
- */
3892
- if (j || p)
3893
- can_fast_forward = 0;
3894
- }
3895
-
3896
- if (can_fast_forward) {
3897
- rollback_lock_file(&lock);
3898
- ret = fast_forward_to(r, &commit->object.oid,
3899
- &head_commit->object.oid, 0, opts);
3900
- if (flags & TODO_EDIT_MERGE_MSG)
3901
- goto fast_forward_edit;
3902
-
3903
- goto leave_merge;
3904
- }
3905
-
3907
if (strategy || to_merge->next) {
3908
/* Octopus merge */
3909
struct child_process cmd = CHILD_PROCESS_INIT;