aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-27 10:59:26 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-27 10:59:26 -0700
commita026bde1ac84f90f0b82faa18890b2023c5198d5 (patch)
tree8e976b861d4b23904c09bb1fbdd8004f37cb6e6f /diff.c
parent09fb53568e3e00e30891b118045aa07ede524103 (diff)
parent3b754eedd58636926d07b14a34799a3aa7b8ebc2 (diff)
downloadgit-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.gz
git-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.xz
Merge branch 'jk/prefix-filename'
Code clean-up with minor bugfixes. * jk/prefix-filename: bundle: use prefix_filename with bundle path prefix_filename: simplify windows #ifdef prefix_filename: return newly allocated string prefix_filename: drop length parameter prefix_filename: move docstring to header file hash-object: fix buffer reuse with --path in a subdirectory
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index a628ac3a9..58cb72d7e 100644
--- a/diff.c
+++ b/diff.c
@@ -4023,8 +4023,7 @@ int diff_opt_parse(struct diff_options *options,
else if (!strcmp(arg, "--pickaxe-regex"))
options->pickaxe_opts |= DIFF_PICKAXE_REGEX;
else if ((argcount = short_opt('O', av, &optarg))) {
- const char *path = prefix_filename(prefix, strlen(prefix), optarg);
- options->orderfile = xstrdup(path);
+ options->orderfile = prefix_filename(prefix, optarg);
return argcount;
}
else if ((argcount = parse_long_opt("diff-filter", av, &optarg))) {
@@ -4071,13 +4070,14 @@ int diff_opt_parse(struct diff_options *options,
else if (!strcmp(arg, "--no-function-context"))
DIFF_OPT_CLR(options, FUNCCONTEXT);
else if ((argcount = parse_long_opt("output", av, &optarg))) {
- const char *path = prefix_filename(prefix, strlen(prefix), optarg);
+ char *path = prefix_filename(prefix, optarg);
options->file = fopen(path, "w");
if (!options->file)
die_errno("Could not open '%s'", path);
options->close_file = 1;
if (options->use_color != GIT_COLOR_ALWAYS)
options->use_color = GIT_COLOR_NEVER;
+ free(path);
return argcount;
} else
return 0;