Skip to contentSkip to conversation

fetch2/git: Anchor names when using ls-remote

PATCH Superseded Richard Purdie 3 participants 5 messages Jan 20, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2/git: Anchor names when using ls-remote

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

---

bitbake/lib/bb/fetch2/git.py +1 -1
index ed55f43..0a2e7bc 100644
@@ -326,7 +326,7 @@ class Git(FetchMethod):
         else:
             username = ""
 
-        cmd = "%s ls-remote %s://%s%s%s %s^{}" % \
+        cmd = "%s ls-remote %s://%s%s%s refs/*/%s^{}" % \
               (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
#1 lore raw
Quoted 9 lines · Richard Purdie

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

Afaict, ls-remote matches the wildcard character against any character, including /.

$ git ls-remote gittest refs/*/foo/bar
69ab4bdbb5f3725ca594a2abdb636ee8fc25e1c4        refs/tags/abc/foo/bar
c8647b027d88af180e90d842577518b73ef6a167        refs/tags/foo/bar
149c3c329515086af1ae4e24b12b17100ae16256        refs/tags/xyz/foo/bar
Signature · 1 line
olofjn
#2 lore raw
Quoted 11 lines · Olof Johansson
Quoted 9 lines · Richard Purdie

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

Quoted 7 lines

Afaict, ls-remote matches the wildcard character against any character, including /.

$ git ls-remote gittest refs/*/foo/bar
69ab4bdbb5f3725ca594a2abdb636ee8fc25e1c4        refs/tags/abc/foo/bar
c8647b027d88af180e90d842577518b73ef6a167        refs/tags/foo/bar
149c3c329515086af1ae4e24b12b17100ae16256        refs/tags/xyz/foo/bar

Yes, I've seen the same behavior:

http://lists.openembedded.org/pipermail/bitbake-devel/2013-August/003724.html

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#3 lore raw
Quoted 15 lines · Martin Jansa
Quoted 14 lines · Olof Johansson
Quoted 9 lines · Richard Purdie

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

Afaict, ls-remote matches the wildcard character against any character, including /.

Quoted 9 lines
Quoted 4 lines
$ git ls-remote gittest refs/*/foo/bar
69ab4bdbb5f3725ca594a2abdb636ee8fc25e1c4        refs/tags/abc/foo/bar
c8647b027d88af180e90d842577518b73ef6a167        refs/tags/foo/bar
149c3c329515086af1ae4e24b12b17100ae16256        refs/tags/xyz/foo/bar

Yes, I've seen the same behavior:

http://lists.openembedded.org/pipermail/bitbake-devel/2013-August/003724.html

Hmm, ok, we can explicitly do:

git ls-remote xxx refs/heads/X refs/tags/X

which should resolve this...

Cheers,

Richard

#4 lore raw
Quoted 23 lines · Richard Purdie
Quoted 22 lines · Martin Jansa
Quoted 11 lines · Olof Johansson
Quoted 9 lines · Richard Purdie

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

Quoted 7 lines

Afaict, ls-remote matches the wildcard character against any character, including /.

$ git ls-remote gittest refs/*/foo/bar
69ab4bdbb5f3725ca594a2abdb636ee8fc25e1c4        refs/tags/abc/foo/bar
c8647b027d88af180e90d842577518b73ef6a167        refs/tags/foo/bar
149c3c329515086af1ae4e24b12b17100ae16256        refs/tags/xyz/foo/bar

Yes, I've seen the same behavior:

Quoted 8 lines
Quoted 2 lines

http://lists.openembedded.org/pipermail/bitbake-devel/2013-August/003724.html

Hmm, ok, we can explicitly do:

git ls-remote xxx refs/heads/X refs/tags/X

which should resolve this...

Looks better to me.

Or if we can be very strict we could use refs/heads/ only when there isn't tag param and refs/tags/ when there is, which would prevent using tag=dead8928392 (as git revision not name of tag).

I don't know how many recipes are using tag= param like this, we do in meta-webos, but I would rather fixed that before upgrading to next release.

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]