Closed matttbe closed 3 years ago
Thank you for reporting this!
I've created a simple list of commands to reproduce your report:
git init issue19 && cd issue19 && git config user.name - && git config user.email -
git commit --allow-empty -m initial_commit
tg create --topmsg a-a t/a-a
echo a-a >a-a && git add a-a
git commit -m a-a
tg info --series # okay
tg create --topmsg a-a-a t/a-a-a
tg info --series # fails; stderr msg on linux, only shows t/a-a-a on stdout (all platforms)
At first I was sure you had fallen afoul of this bug:
# the "UTF-8" or "utf8" locale used must be in the `locale -a` output (but NOT C.UTF-8!)
for lcl in C en_US.UTF-8; do
printf '\nLC_ALL=%s:\n' "$lcl"
printf '%s\n' 't/aa-b' 't/a-b' | LC_ALL="$lcl" sort
done
But after some head scratching, I determined that's not what's going on here.
Internally, ref names get an implicit trailing "/" added during an early processing phase that later gets removed again.
What's happening is that instead of sorting these two lines:
t/a-a
t/a-a-a
TopGit is actually sorting these two lines:
t/a-a/
t/a-a-a/
And since the "-
" (hex 0x2D) comes before the "/
" (hex 0x2F) character they end up in this order:
t/a-a-a/
t/a-a/
Before the trailing "/
" ultimately gets removed resulting in this list:
t/a-a-a
t/a-a
Which is no longer sorted correctly. The version of join
you're using helpfully gives a diagnostic message (join
's input must always be properly sorted), but some other platforms' join commands skip the diagnostic message while still producing the incorrect output which is somewhat less helpful in locating the problem.
I'm now looking at the best way to fix this and will post a patch for you as soon as I have one. And I will be adding a new test case to the test suite to check for this particular case.
Turns out that ended up not being quite as messy as I thought to fix.
Here's a patch against the 0.19.12 release:
https://github.com/mackyle/topgit/blob/06fd19262036a015/patch.txt
It will be included in the forthcoming release which is turning out to be primarily a collection of fixes.
Thank you for looking at this issue, giving clear explanations (tricky issue :) ) and the patch!
I just applied the patch locally and it fixes my issue. I also validated it on a public repo I maintain with TopGit and it fixes issues there too! Thanks!
The topgit-0.19.13 release includes the fix for this (and other reported issues).
Thank you for this great new release!
Hello,
First, thank you for developing and maintaining this great tool!
If I have two topics like
t/a-a
andt/a-a-a
, it creates issues with some commands liketg info --series
:No issue to create the base:
No issue to create a new topic:
But here,
tg info --series
complains: