summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-21 01:31:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-21 18:18:41 (GMT)
commit3b754eedd58636926d07b14a34799a3aa7b8ebc2 (patch)
tree4019a9f90e18676fe1cf6f1df37f8b67df0e5754 /builtin/rev-parse.c
parentaf10e8b1559790d5c78fcc2a1aae5c42f3930a00 (diff)
downloadgit-3b754eedd58636926d07b14a34799a3aa7b8ebc2.zip
git-3b754eedd58636926d07b14a34799a3aa7b8ebc2.tar.gz
git-3b754eedd58636926d07b14a34799a3aa7b8ebc2.tar.bz2
bundle: use prefix_filename with bundle path
We may take the path to a bundle file as an argument, and need to adjust the filename based on the prefix we discovered while setting up the git directory. We do so manually into a fixed-size buffer, but using prefix_filename() is the normal way. Besides being more concise, there are two subtle improvements: 1. The original inserted a "/" between the two paths, even though the "prefix" argument always has the "/" appended. That means that: cd subdir && git bundle verify ../foo.bundle was looking at (and reporting) subdir//../foo.bundle. Harmless, but ugly. Using prefix_filename() gets this right. 2. The original checked for an absolute path by looking for a leading '/'. It should have been using is_absolute_path(), which also covers more cases on Windows (backslashes and dos drive prefixes). But it's easier still to just pass the name to prefix_filename(), which handles this case automatically. Note that we'll just leak the resulting buffer in the name of simplicity, since it needs to last through the duration of the program anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
0 files changed, 0 insertions, 0 deletions