Merge git://repo.or.cz/git-gui
[gitweb.git] / builtin-commit.c
index 6a9dc0e30fc23d79df099fbd05b69bacf54238be..f7c053a0106c2e42833d0d7c7255b7b636d09a93 100644 (file)
@@ -555,6 +555,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
                fprintf(fp,
                        "\n"
                        "# Please enter the commit message for your changes.\n"
+                       "# To abort the commit, use an empty commit message.\n"
                        "# (Comment lines starting with '#' will ");
                if (cleanup_mode == CLEANUP_ALL)
                        fprintf(fp, "not be included)\n");
@@ -646,7 +647,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
                char index[PATH_MAX];
                const char *env[2] = { index, NULL };
                snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
-               launch_editor(git_path(commit_editmsg), NULL, env);
+               if (launch_editor(git_path(commit_editmsg), NULL, env)) {
+                       fprintf(stderr,
+                       "Please supply the message using either -m or -F option.\n");
+                       exit(1);
+               }
        }
 
        if (!no_verify &&