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

Re: Bug with fixup and autosquash

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 9, 2017, 20:55 UTC
Message-ID
<alpine.DEB.2.20.1702092142020.3496@virtualbox>
In-Reply-To
<xmqqbmucuwb0.fsf@gitster.mtv.corp.google.com>
Hi Ashutosh and Junio,
On Wed, 8 Feb 2017, Junio C Hamano wrote:
Show 32 quoted lines
> Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:
> 
> > I have been using git rebase heavily these days and seem to have found
> > a bug.
> >
> > If there are two commit messages which have same prefix e.g.
> > yyyyyy This is prefix
> > xxxxxx This is prefix and message
> >
> > xxxxxx comitted before yyyyyy
> >
> > Now I commit a fixup to yyyyyy using git commit --fixup yyyyyy
> > zzzzzz fixup! This is prefix
> >
> > When I run git rebase -i --autosquash, the script it shows me looks like
> > pick xxxxxx This is prefix and message
> > fixup zzzzzz fixup! This is prefix
> > pick yyyyyy This is prefix
> >
> > I think the correct order is
> > pick xxxxxx This is prefix and message
> > pick yyyyyy This is prefix
> > fixup zzzzzz fixup! This is prefix
> >
> > Is that right?
> 
> [...]
> 
> Unfortunately, "rebase -i --autosquash" reorders the entries by
> identifying the commit by its title, and it goes with prefix match so
> that fix-up commits created without using --fixup option but manually
> records the title's prefix substring can also work.  

This prefix match also happens to introduce a serious performance problem, which is why I "fixed" this issue in the rebase--helper already (which is the case if you are using Git for Windows, whose master branch builds on Linux and MacOSX as well). I quoted "fix" because my motivation was to fix the performance problem, not the "incorrect match" problem.

The rebase--helper code (specifically, the patch moving autosquash logic into it: https://github.com/dscho/git/commit/7d0831637f) tries to match exact onelines first, and falls back to prefix matching only after that.

Now that the sequencer-i patch series is in `master`, the next step is to send the patch series introducing the rebase--helper. The patch series including the fix discussed above relies on that one. Meaning that it will take a while to get through the mill.

So please do not hold your breath until this feature/fix hits an official Git version. If you need it[*1*] faster, feel free to build Git for Windows' master and run with that for a while.

Ciao, Johannes

Footnote: By "it" I mean "the feature/fix", not "an official Git version"
nor "your breath".
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 14 in “Bug with fixup and autosquash”
  1. Ashutosh BapatFeb 8, 2017
  2. Junio C HamanoFeb 8, 2017
  3. Ashutosh BapatFeb 9, 2017
  4. Michael J GruberFeb 9, 2017
  5. Junio C HamanoFeb 9, 2017
  6. Johannes SchindelinFeb 9, 2017
  7. Junio C HamanoFeb 9, 2017
  8. Johannes SchindelinFeb 9, 2017
  9. Junio C HamanoFeb 9, 2017
  10. Johannes SchindelinFeb 10, 2017
  11. Philip OakleyFeb 10, 2017
  12. Johannes SchindelinApr 25, 2017
  13. Philip OakleyFeb 9, 2017
  14. Johannes SchindelinFeb 10, 2017

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.