summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-19 16:06:21 -0700
committerJunio C Hamano <gitster@pobox.com>2008-10-19 16:06:21 -0700
commit4f2d651e5b3414eac5d22ff47366d22c8cc289f6 (patch)
tree1d6a6531fe0170679bfd193c4516e91c00cbb438 /builtin-commit.c
parentce6e5ff435f325769dd28980cf3c8b1625f194f2 (diff)
parentcf10f9fdd5e673a163847f0e931ce9731507e03b (diff)
downloadgit-4f2d651e5b3414eac5d22ff47366d22c8cc289f6.tar.gz
Merge branch 'mv/merge-noff'
* mv/merge-noff: builtin-commit: use reduce_heads() only when appropriate Conflicts: builtin-commit.c t/t7600-merge.sh
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index 2c33af2766..33b659edce 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -943,6 +943,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
unsigned char commit_sha1[20];
struct ref_lock *ref_lock;
struct commit_list *parents = NULL, **pptr = &parents;
+ struct stat statbuf;
+ int allow_fast_forward = 1;
git_config(git_commit_config, NULL);
@@ -989,13 +991,22 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
}
fclose(fp);
strbuf_release(&m);
+ if (!stat(git_path("MERGE_MODE"), &statbuf)) {
+ if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
+ die("could not read MERGE_MODE: %s",
+ strerror(errno));
+ if (!strcmp(sb.buf, "no-ff"))
+ allow_fast_forward = 0;
+ }
+ if (allow_fast_forward)
+ parents = reduce_heads(parents);
} else {
reflog_msg = "commit";
pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
}
- parents = reduce_heads(parents);
/* Finally, get the commit message */
+ strbuf_reset(&sb);
if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
rollback_index_files();
die("could not read commit message");
@@ -1044,6 +1055,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
unlink(git_path("MERGE_HEAD"));
unlink(git_path("MERGE_MSG"));
+ unlink(git_path("MERGE_MODE"));
unlink(git_path("SQUASH_MSG"));
if (commit_index_files())