diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-06 11:43:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-06 13:38:18 -0700 |
commit | dbd0f5c7692cce0c5fea535a06622b3a93df9598 (patch) | |
tree | 92606e8799f9f518296ef4e9124cf782d7e234f2 /builtin-tag.c | |
parent | eabbc99a2198d1cae62ce951457e7edc23b5f1a9 (diff) | |
download | git-dbd0f5c7692cce0c5fea535a06622b3a93df9598.tar.gz |
Files given on the command line are relative to $cwd
When running "git commit -F file" and "git tag -F file" from a
subdirectory, we should take it as relative to the directory we started
from, not relative to the top-level directory.
This adds a helper function "parse_options_fix_filename()" to make it more
convenient to fix this class of issues. Ideally, parse_options() should
support a new type of option, "OPT_FILENAME", to do this uniformly, but
this patch is meant to go to 'maint' to fix it minimally.
One thing to note is that value for "commit template file" that comes from
the command line is taken as relative to $cwd just like other parameters,
but when it comes from the configuration varilable 'commit.template', it
is taken as relative to the working tree root as before. I think this
difference actually is sensible (not that I particularly think
commit.template itself is sensible).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-tag.c')
-rw-r--r-- | builtin-tag.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-tag.c b/builtin-tag.c index 3c97c696a5..3bd019cc56 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -385,7 +385,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) int annotate = 0, sign = 0, force = 0, lines = 0, list = 0, delete = 0, verify = 0; - char *msgfile = NULL, *keyid = NULL; + const char *msgfile = NULL, *keyid = NULL; struct msg_arg msg = { 0, STRBUF_INIT }; struct option options[] = { OPT_BOOLEAN('l', NULL, &list, "list tag names"), @@ -411,6 +411,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) git_config(git_tag_config, NULL); argc = parse_options(argc, argv, options, git_tag_usage, 0); + msgfile = parse_options_fix_filename(prefix, msgfile); if (keyid) { sign = 1; |