summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-06-17 17:15:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-17 17:15:17 (GMT)
commit6e0b1c60ad3e6067d5cae51a7dc36e58184accd5 (patch)
tree030db59bb6a9b059c1cc968e80bcc6fd7dfcabfe /builtin
parent3a54d80ac8a1decac6fa158175fb16f0563f5c15 (diff)
parent1d14d0c9949c02260fe4f8b3a54a1b5c605823a2 (diff)
downloadgit-6e0b1c60ad3e6067d5cae51a7dc36e58184accd5.zip
git-6e0b1c60ad3e6067d5cae51a7dc36e58184accd5.tar.gz
git-6e0b1c60ad3e6067d5cae51a7dc36e58184accd5.tar.bz2
Merge branch 'vv/merge-squash-with-explicit-commit'
"git merge --squash" is designed to update the working tree and the index without creating the commit, and this cannot be countermanded by adding the "--commit" option; the command now refuses to work when both options are given. * vv/merge-squash-with-explicit-commit: merge: refuse --commit with --squash
Diffstat (limited to 'builtin')
-rw-r--r--builtin/merge.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 5c83f89..6e99aea 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -59,7 +59,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;
@@ -1345,9 +1345,19 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (squash) {
if (fast_forward == FF_NO)
die(_("You cannot combine --squash with --no-ff."));
+ if (option_commit > 0)
+ die(_("You cannot combine --squash with --commit."));
+ /*
+ * 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;
}
+ if (option_commit < 0)
+ option_commit = 1;
+
if (!argc) {
if (default_to_upstream)
argc = setup_with_upstream(&argv);