summaryrefslogtreecommitdiff
path: root/gitweb/git-logo.png
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-01-28 22:44:27 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-02-05 00:44:10 -0800
commitd089ebaad5315325d67db30176df1bbd7754fda9 (patch)
tree2c3c9e8d7a66de215e409d223ae69bc2c1e39a04 /gitweb/git-logo.png
parentman pages are littered with .ft C and others (diff)
downloadtgif-d089ebaad5315325d67db30176df1bbd7754fda9.tar.xz
setup: sanitize absolute and funny paths in get_pathspec()
The prefix_path() function called from get_pathspec() is responsible for translating list of user-supplied pathspecs to list of pathspecs that is relative to the root of the work tree. When working inside a subdirectory, the user-supplied pathspecs are taken to be relative to the current subdirectory. Among special path components in pathspecs, we used to accept and interpret only "." ("the directory", meaning a no-op) and ".." ("up one level") at the beginning. Everything else was passed through as-is. For example, if you are in Documentation/ directory of the project, you can name Documentation/howto/maintain-git.txt as: howto/maintain-git.txt ../Documentation/howto/maitain-git.txt ../././Documentation/howto/maitain-git.txt but not as: howto/./maintain-git.txt $(pwd)/howto/maintain-git.txt This patch updates prefix_path() in several ways: - If the pathspec is not absolute, prefix (i.e. the current subdirectory relative to the root of the work tree, with terminating slash, if not empty) and the pathspec is concatenated first and used in the next step. Otherwise, that absolute pathspec is used in the next step. - Then special path components "." (no-op) and ".." (up one level) are interpreted to simplify the path. It is an error to have too many ".." to cause the intermediate result to step outside of the input to this step. - If the original pathspec was not absolute, the result from the previous step is the resulting "sanitized" pathspec. Otherwise, the result from the previous step is still absolute, and it is an error if it does not begin with the directory that corresponds to the root of the work tree. The directory is stripped away from the result and is returned. - In any case, the resulting pathspec in the array get_pathspec() returns omit the ones that caused errors. With this patch, the last two examples also behave as expected. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/git-logo.png')
0 files changed, 0 insertions, 0 deletions