summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2011-07-05 17:54:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-07-06 18:12:01 (GMT)
commitb3cfc4066d87476726e8711a8b5fc3b721aba41c (patch)
treeece11d91ef62e7704263d93b67978d36fe03db27 /refs.h
parent5df3e2b3ca5ebe8123927a81d682993ad597a584 (diff)
downloadgit-b3cfc4066d87476726e8711a8b5fc3b721aba41c.zip
git-b3cfc4066d87476726e8711a8b5fc3b721aba41c.tar.gz
git-b3cfc4066d87476726e8711a8b5fc3b721aba41c.tar.bz2
Fix prefix handling in ref iteration functions
The do_for_each_ref iteration function accepts a prefix and a trim, and checks for the prefix on each ref before passing in that ref; it also supports trimming off part of the ref before passing it. However, do_for_each_ref used trim as the length of the prefix to check, ignoring the actual length of the prefix. Switch to using prefixcmp, checking the entire length of the prefix string, to properly support a trim value different than the length of the prefix. Several callers passed a prefix of "refs/" to filter out everything outside of refs/, but a trim of 0 to avoid trimming off the "refs/"; the trim of 0 meant that the filter of "refs/" no longer applied. Change these callers to pass an empty prefix instead, to avoid changing the existing behavior. Various callers count on this lack of filtering, such as receive-pack which uses add_extra_ref to add alternates as refs named ".have"; adding filtering would break that, causing t5501-fetch-push-alternates.sh to fail. That lack of filtering doesn't currently have any other effect, since the loose ref functions can never supply refs outside of "refs/", and packed-refs will not normally include such refs unless manually edited. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
0 files changed, 0 insertions, 0 deletions