]> git.ipfire.org Git - thirdparty/git.git/commit
versioncmp: pass full tagnames to swap_prereleases()
authorSZEDER Gábor <szeder.dev@gmail.com>
Thu, 8 Dec 2016 14:23:58 +0000 (15:23 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Dec 2016 19:11:57 +0000 (11:11 -0800)
commit109064a0313c8a7c337f37936077ef3c9171d7ce
tree2ce06fd8e0556048bf85c90e4eebd22a0baabcc2
parent0c1b4878dec423a0d322bffc5607de584aab214e
versioncmp: pass full tagnames to swap_prereleases()

The swap_prereleases() helper function is responsible for finding
configured prerelease suffixes in a pair of tagnames to be compared,
but this function currently gets to see only the parts of those two
tagnames starting at the first different character.  To fix some
issues related to the common part of two tagnames overlapping with
leading part of a prerelease suffix, this helper function must see
both full tagnames.

In preparation for the fix in the following patch, refactor
swap_prereleases() and its caller to pass two full tagnames and an
additional offset indicating the position of the first different
character.

While updating the comment describing that function, remove the
sentence about not dealing with both tagnames having the same suffix.
Currently it doesn't add much value (we know that there is a different
character, so it's obvious that it can't possibly be the same suffix
in both), and at the end of this patch series it won't even be true
anymore.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
versioncmp.c