git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Oct 2018, #04; Fri, 19)

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 22, 2018, 21:38 UTC
Message-ID
<nycvar.QRO.7.76.6.1810222306180.4546@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqmur8yyi3.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Sun, 21 Oct 2018, Junio C Hamano wrote:
Show 26 quoted lines
> 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."

We already have a way to say "I am giving you an oid": append `^0` to the hash.

I implemented a fix, pushed it up to GitGitGadget, and will submit it tomorrow (after a fresh look, and after the build finished): https://github.com/gitgitgadget/git/pull/52

Ciao, Dscho

Previous: Junio C HamanoNext: Derrick Stolee
Message 6 of 8 in “What's cooking in git.git (Oct 2018, #04; Fri, 19)”
  1. Junio C HamanoOct 19, 2018
  2. SZEDER GáborOct 19, 2018
  3. Alban GruinOct 19, 2018
  4. Alban GruinOct 20, 2018
  5. Junio C HamanoOct 20, 2018
  6. Johannes SchindelinOct 22, 2018
  7. Derrick StoleeOct 19, 2018
  8. Johannes SixtOct 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.