diff options
-rw-r--r-- | builtin-commit.c | 4 | ||||
-rwxr-xr-x | t/t7500-commit.sh | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index 81371b1d2..baaa75cf9 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -699,7 +699,11 @@ static int parse_and_validate_options(int argc, const char *argv[], argc = parse_options(argc, argv, builtin_commit_options, usage, 0); logfile = parse_options_fix_filename(prefix, logfile); + if (logfile) + logfile = xstrdup(logfile); template_file = parse_options_fix_filename(prefix, template_file); + if (template_file) + template_file = xstrdup(template_file); if (force_author && !strchr(force_author, '>')) force_author = find_author_by_nickname(force_author); diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index 5998baf27..8eec0fa9b 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -183,4 +183,14 @@ test_expect_success 'commit message from stdin' ' commit_msg_is "Log with foo word" ' +test_expect_success 'commit -F overrides -t' ' + ( + cd subdir && + echo "-F log" > f.log && + echo "-t template" > t.template && + git commit --allow-empty -F f.log -t t.template + ) && + commit_msg_is "-F log" +' + test_done |