From: Junio C Hamano <gitster@pobox.com>
To: Alban Gruin <alban.gruin@gmail.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"Pratik Karki" <predatoramigo@gmail.com>,
git@vger.kernel.org
Subject: Re: What's cooking in git.git (Oct 2018, #04; Fri, 19)
Date: Sun, 21 Oct 2018 08:44:20 +0900 [thread overview]
Message-ID: <xmqqmur8yyi3.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <5f0fb76f-0774-3545-38fc-b86137f747fa@gmail.com> (Alban Gruin's message of "Sat, 20 Oct 2018 16:31:59 +0200")
Alban Gruin <alban.gruin@gmail.com> writes:
> The error comes from the call to `git stash apply $stash_id' in
> builtin/rebase.c:261. When $stash_id only contains decimals and no
> letters, git-stash tries to apply stash@{$stash_id}[0][1]. Thas was not
> a real problem with the shell script, because it did not abbreviate the
> object id of the stashed commit, so it was very unlikely that the oid
> would contain only digits. builtin/rebase.c shortens the oid[2], making
> this problem more likely to occur.
OK, so make "rebase in C" a faithful conversion of the original, the
code that lead to builtin/rebase.c:261 must be fixed not to pass a
shortened oid. I suspect that internally it has a full object name,
so not shortening would be the right thing anyway, so regaredless of
this bug, it probably makes sense to do the fix.
But as you said, even the scripted version that passed the full
object name had a (10/16^40) chance of using a 40-hex that only has
[0-9] and caused the same breakage, so such a change to "rebase in
C" is sweeping the age old bug under the same rug, in the context of
discussing this particular bug.
I agree with you that it is a better fix to the problem to allow the
caller to say "I am giving an oid---it may (or may not---I do not
even bother to check) consist of only digits, but do not treat it as
an index to the stash reflog."
next prev parent reply other threads:[~2018-10-20 23:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 6:02 What's cooking in git.git (Oct 2018, #04; Fri, 19) Junio C Hamano
2018-10-19 12:46 ` SZEDER Gábor
2018-10-19 18:05 ` Alban Gruin
2018-10-20 14:31 ` Alban Gruin
2018-10-20 23:44 ` Junio C Hamano [this message]
2018-10-22 21:38 ` Johannes Schindelin
2018-10-19 13:40 ` Derrick Stolee
2018-10-19 17:55 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmur8yyi3.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=alban.gruin@gmail.com \
--cc=git@vger.kernel.org \
--cc=predatoramigo@gmail.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).