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

Re: [PATCHv2] Do not autosquash in case of an implied interactive rebase

From
Junio C Hamano <gitster@pobox.com>
Date
May 25, 2012, 17:50 UTC
Message-ID
<7vehq8tajh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1337867846-5336-1-git-send-email-vfr@lyx.org>
Vincent van Ravesteijn <vfr@lyx.org> writes:
Show 5 quoted lines
> The option to autosquash is only used in case of an interactive rebase.
> When merges are preserved, rebase uses an interactive rebase internally,
> but in this case autosquash should still be disabled.
>
> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>

Hrm, what if the end user said "git rebase --autosquash -p" explicitly from the command line?

I _think_ you are addressing the case where rebase.autosquash is set to true in the configuration. The handling of that variable that was added in dd1e5b3 (add configuration variable for --autosquash option of interactive rebase, 2010-07-14) is not correct. The configuration should kick in only when the end user did not explicitly give either --autosquash or --no-autosquash, so the variable $autosquash is logically a tristate (unknown, set to yes, set to no), initialized to "unknown", set to either value when --[no-]autosquash option is seen, and fall back to the configured value _only_ after the option parsing loop exits and the variable is still set to "unknown". In other words, the current:

	autosquash=$(ask rebase.autosquash or default to no)
        for each option:
        	if option == --autosquash: autosquash=yes
                if option == --no-autosquash: autosquash=no

is wrong and I think this patch is trying to sweep that real problem under the rug. Shouldn't the fix be more like the following, learning from what was done to the "implied interactive rebase" case, to fix the option parsing loop?

	autosquash=unknown
        interactive_rebase=unknown
        for each option:
        	if option == --autosquash: autosquash=yes
                if option == --no-autosquash: autosquash=no
                if option == --preserve-merges:
                	preserve_merges=yes
                        if interactive_rebase is unknown:
				interactive_rebase=implied
			if autosquash is unknown:
                        	autosquash=no
		... other options ...
	if autosquash is unknown:
        	autosquash=$(ask rebase.autosquash or default to no)
Previous: Vincent van RavesteijnNext: Vincent van Ravesteijn
Message 3 of 6 in “Do not autosquash in case of an implied interactive rebase”
  1. Do not autosquash in case of an implied interactive rebaseVincent van Ravesteijn, May 24, 2012
  2. [PATCHv2] Do not autosquash in case of an implied interactive rebaseVincent van Ravesteijn, May 24, 2012
  3. Junio C HamanoMay 25, 2012
  4. Vincent van RavesteijnMay 28, 2012
  5. Junio C HamanoMay 29, 2012
  6. Junio C HamanoMay 29, 2012

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.