make git-clone GIT_WORK_TREE aware
[gitweb.git] / builtin-fmt-merge-msg.c
index 14898835649f4156c86f53ecde658009c735ca3f..ae60fccea74077b4d2456919d2f911f8a257c5b4 100644 (file)
@@ -259,13 +259,15 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
                else if (!strcmp(argv[1], "--no-summary"))
                        merge_summary = 0;
                else if (!strcmp(argv[1], "-F") || !strcmp(argv[1], "--file")) {
-                       if (argc < 2)
+                       if (argc < 3)
                                die ("Which file?");
                        if (!strcmp(argv[2], "-"))
                                in = stdin;
                        else {
                                fclose(in);
                                in = fopen(argv[2], "r");
+                               if (!in)
+                                       die("cannot open %s", argv[2]);
                        }
                        argc--; argv++;
                } else
@@ -355,4 +357,3 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 
        return 0;
 }
-