Presently only one merge mode exists: non-fast-forward. But in future
the second one (transpose-parents) will be added, so the need to read
all lines of MERGE_MODE.

Signed-off-by: Kacper Kornet <drae...@pld-linux.org>
---
 builtin/commit.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 273332f..ee0e884 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1427,7 +1427,6 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
        unsigned char sha1[20];
        struct ref_lock *ref_lock;
        struct commit_list *parents = NULL, **pptr = &parents;
-       struct stat statbuf;
        int allow_fast_forward = 1;
        struct commit *current_head = NULL;
        struct commit_extra_header *extra = NULL;
@@ -1481,11 +1480,12 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
 
                if (!reflog_msg)
                        reflog_msg = "commit (merge)";
-               if (!stat(git_path("MERGE_MODE"), &statbuf)) {
-                       if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 
0)
-                               die_errno(_("could not read MERGE_MODE"));
-                       if (!strcmp(sb.buf, "no-ff"))
-                               allow_fast_forward = 0;
+               if((fp = fopen(git_path("MERGE_MODE"), "r"))) {
+                       while (strbuf_getline(&m, fp, '\n') != EOF) {
+                               if (!strcmp(m.buf, "no-ff"))
+                                       allow_fast_forward = 0;
+                       }
+                       fclose(fp);
                }
                pptr = &commit_list_insert(current_head, pptr)->next;
                fp = fopen(git_path("MERGE_HEAD"), "r");
-- 
1.8.0.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to