diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
| commit | a026bde1ac84f90f0b82faa18890b2023c5198d5 (patch) | |
| tree | 8e976b861d4b23904c09bb1fbdd8004f37cb6e6f /diff-no-index.c | |
| parent | Merge branch 'jc/lint-runaway-here-doc' (diff) | |
| parent | bundle: use prefix_filename with bundle path (diff) | |
| download | git-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.gz git-a026bde1ac84f90f0b82faa18890b2023c5198d5.zip | |
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-no-index.c')
| -rw-r--r-- | diff-no-index.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/diff-no-index.c b/diff-no-index.c index df762fd0f7..79229382b0 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -236,7 +236,7 @@ static void fixup_paths(const char **path, struct strbuf *replacement) void diff_no_index(struct rev_info *revs, int argc, const char **argv) { - int i, prefixlen; + int i; const char *paths[2]; struct strbuf replacement = STRBUF_INIT; const char *prefix = revs->prefix; @@ -257,7 +257,6 @@ void diff_no_index(struct rev_info *revs, } } - prefixlen = prefix ? strlen(prefix) : 0; for (i = 0; i < 2; i++) { const char *p = argv[argc - 2 + i]; if (!strcmp(p, "-")) @@ -266,8 +265,8 @@ void diff_no_index(struct rev_info *revs, * path that is "-", spell it as "./-". */ p = file_from_standard_input; - else if (prefixlen) - p = xstrdup(prefix_filename(prefix, prefixlen, p)); + else if (prefix) + p = prefix_filename(prefix, p); paths[i] = p; } |
