Package: git-debpush
Version: 13.11
This code
git log --pretty=format:'%D' --decorate=full "$branch_commit" \
| perl -MDpkg::Version -F", " -we'
@debian_tag_vs =
sort { version_compare($b, $a) } grep defined,
map m|tag: refs/tags/'"$prefix"'(.+)|, @F
or next;
print "'"$prefix"'$debian_tag_vs[0]\n"; exit'
is wrong because it passes gitified version numbers (ie mangled
according to DEP-14) to version_compare. version_compare rejects `_`
(and presumably, if it accepted it, it would DTWT).
The version_compare is only called if the user has two debian/* tags
on the same commit, which would be an anomaly in itself. But, I can
repro the fault as follows:
STEPS
git clone --no-tags [email protected]:python-team/packages/bundlewrap
cd bundlewrap
git fetch origin
refs/tags/debian/4.23.1-1_exp1:refs/tags/debian/4.23.1-1_exp1
refs/tags/upstream/4.23.1:refs/tags/upstream/4.23.1
git tag -m anomalous debian/4.23.1-1 debian/4.23.1-1_exp1~0
git debpush --dry-run --force=detached
ACTUAL BEHAVIOUR
git-debpush: warning: HEAD is detached; you probably don't want to debpush it
('detached' check)
-e: error: 4.23.1-1_exp1 is not a valid version
EXPECTED BEHAVIOUR
4.23.1 > 4.23.1-1~exp1 so it should prefer the "later" 4.23.1 tag,
which has no dgit metadata, so:
git-debpush: warning: HEAD is detached; you probably don't want to debpush it
('detached' check)
git-debpush: could not determine the git branch layout
git-debpush: please supply a --quilt= argument
However, I'm not convinced that sorting by version number here is
right, in any case. If there are multiple tags, why wouldn't we
prefer the latest one by tag date?
Empirically, git log --pretty=format:%D prints tags for the same
commit in tagger date order, so we could just take the last.
Ian.
--
Ian Jackson <[email protected]> These opinions are my own.
Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.