path: root/refs.h
diff options
authorJosh Triplett <>2011-07-05 17:54:21 (GMT)
committerJunio C Hamano <>2011-07-06 18:12:01 (GMT)
commitb3cfc4066d87476726e8711a8b5fc3b721aba41c (patch)
treeece11d91ef62e7704263d93b67978d36fe03db27 /refs.h
parent5df3e2b3ca5ebe8123927a81d682993ad597a584 (diff)
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 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 <> Signed-off-by: Jamey Sharp <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'refs.h')
0 files changed, 0 insertions, 0 deletions