summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2009-05-23 18:53:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-05-25 08:07:33 (GMT)
commitdf217ed6430efe444a09fffdafd39720ae3f9864 (patch)
treedc87087a7cff7332fb9de36c7d3cad6e37b5df9c /builtin-commit.c
parent377829201783b8a648e07af6ce7d747e0f45dc19 (diff)
downloadgit-df217ed6430efe444a09fffdafd39720ae3f9864.zip
git-df217ed6430efe444a09fffdafd39720ae3f9864.tar.gz
git-df217ed6430efe444a09fffdafd39720ae3f9864.tar.bz2
parse-opts: add OPT_FILENAME and transition builtins
Commit dbd0f5c (Files given on the command line are relative to $cwd, 2008-08-06) introduced parse_options_fix_filename() as a minimal fix. OPT_FILENAME is intended to be a more robust fix for the same issue. OPT_FILENAME and its associated enum OPTION_FILENAME are used to represent filename options within the parse options API. This option is similar to OPTION_STRING. If --no is prefixed to the option the filename is unset. If no argument is given and the default value is set, the filename is set to the default value. The difference is that the filename is prefixed with the prefix passed to parse_options() (or parse_options_start()). Update git-apply, git-commit, git-fmt-merge-msg, and git-tag to use OPT_FILENAME with their filename options. Also, rename parse_options_fix_filename() to fix_filename() as it is no longer extern. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index b9a1528..41e222d 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -88,13 +88,13 @@ static struct option builtin_commit_options[] = {
OPT__VERBOSE(&verbose),
OPT_GROUP("Commit message options"),
- OPT_STRING('F', "file", &logfile, "FILE", "read log from file"),
+ OPT_FILENAME('F', "file", &logfile, "read log from file"),
OPT_STRING(0, "author", &force_author, "AUTHOR", "override author for commit"),
OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m),
OPT_STRING('c', "reedit-message", &edit_message, "COMMIT", "reuse and edit message from specified commit "),
OPT_STRING('C', "reuse-message", &use_message, "COMMIT", "reuse message from specified commit"),
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
- OPT_STRING('t', "template", &template_file, "FILE", "use specified template file"),
+ OPT_FILENAME('t', "template", &template_file, "use specified template file"),
OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
OPT_GROUP("Commit contents options"),
@@ -699,12 +699,6 @@ static int parse_and_validate_options(int argc, const char *argv[],
argc = parse_options(argc, argv, prefix, 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);