@@ -95,6 +95,8 @@ merge.
+
With --no-squash perform the merge and commit the result. This
option can be used to override --squash.
++
+With --squash, --commit is not allowed, and will fail.
-s <strategy>::
--strategy=<strategy>::
@@ -57,7 +57,7 @@ static const char * const builtin_merge_usage[] = {
};
static int show_diffstat = 1, shortlog_len = -1, squash;
-static int option_commit = 1;
+static int option_commit = -1;
static int option_edit = -1;
static int allow_trivial = 1, have_message, verify_signatures;
static int overwrite_ignore = 1;
@@ -1304,9 +1304,25 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (verbosity < 0)
show_diffstat = 0;
+ /*
+ * This indicates option_commit was influenced by the command line.
+ * Check and error out for the squash case.
+ */
+ if ((option_commit > 0) && squash)
+ die(_("You cannot combine --squash with --commit."));
+
+ /* If option_commit is the default '-1', we can 'enable' it */
+ if (option_commit < 0)
+ option_commit = 1;
+
if (squash) {
if (fast_forward == FF_NO)
die(_("You cannot combine --squash with --no-ff."));
+ /*
+ * squash can now silently disable option_commit - this is not
+ * a problem as it is only overriding the default, not a user
+ * supplied option.
+ */
option_commit = 0;
}