diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-07-26 23:15:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-27 14:14:01 -0700 |
commit | 47c6ef1c8def9a20b4ff40825456b45f5e63b51f (patch) | |
tree | 9900d4707292f82f65bdbe8828069392b5e7974d /t/t4013/diff.diff-tree_--pretty_--root_-p_initial | |
parent | gitweb: More about how gitweb gets 'owner' of repository (diff) | |
download | tgif-47c6ef1c8def9a20b4ff40825456b45f5e63b51f.tar.xz |
make sure parsed wildcard refspec ends with slash
A wildcard refspec is internally parsed into a refspec structure with src
and dst strings. Many parts of the code assumed that these do not include
the trailing "/*" when matching the wildcard pattern with an actual ref we
see at the remote. What this meant was that we needed to make sure not
just that the prefix matched, and also that a slash followed the part that
matched.
But a codepath that scans the result from ls-remote and finds matching
refs forgot to check the "matching part must be followed by a slash" rule.
This resulted in "refs/heads/b1" from the remote side to mistakenly match
the source side of "refs/heads/b/*:refs/remotes/b/*" refspec.
Worse, the refspec crafted internally by "git-clone", and a hardcoded
preparsed refspec that is used to implement "git-fetch --tags", violated
this "parsed widcard refspec does not end with slash" rule; simply adding
the "matching part must be followed by a slash" rule then would have
broken codepaths that use these refspecs.
This commit changes the rule to require a trailing slash to parsed
wildcard refspecs. IOW, "refs/heads/b/*:refs/remotes/b/*" is parsed as
src = "refs/heads/b/" and dst = "refs/remotes/b/". This allows us to
simplify the matching logic because we only need to do a prefixcmp() to
notice "refs/heads/b/one" matches and "refs/heads/b1" does not.
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff-tree_--pretty_--root_-p_initial')
0 files changed, 0 insertions, 0 deletions