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

Re: [BUG] rebase no longer omits local commits

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2014, 17:56 UTC
Message-ID
<xmqqbnt1dpdk.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140703222501.GF13153@serenity.lan>
John Keeping <john@keeping.me.uk> writes:
Show 23 quoted lines
> Perhaps we shuld do something like this (which passes the test suite):
>
> -- >8 --
> diff --git a/git-rebase.sh b/git-rebase.sh
> index 06c810b..0c6c5d3 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -544,7 +544,8 @@ if test "$fork_point" = t
>  then
>  	new_upstream=$(git merge-base --fork-point "$upstream_name" \
>  			"${switch_to:-HEAD}")
> -	if test -n "$new_upstream"
> +	if test -n "$new_upstream" &&
> +	   ! git merge-base --is-ancestor "$new_upstream" "$upstream_name"
>  	then
>  		upstream=$new_upstream
>  	fi
> -- 8< --
>
> Since the intent of `--fork-point` is to find the best starting point
> for the "$upstream...$orig_head" range, if the fork point is behind the
> new location of the upstream then should we leave the upstream as it
> was?

Probably; but the check to avoid giving worse fork-point should be in the implementation of "merge-base --fork-point" itself, so that we do not have to do the above to both "rebase" and "pull --rebase", no?

> I haven't thought through this completely, but it seems like we should
> be doing a check like the above, at least when we're in
> "$fork_point=auto" mode.
Previous: John KeepingNext: John Keeping
Message 4 of 15 in “[BUG] rebase no longer omits local commits”
  1. Ted FelixJul 3, 2014
  2. John KeepingJul 3, 2014
  3. John KeepingJul 3, 2014
  4. Junio C HamanoJul 7, 2014
  5. John KeepingJul 7, 2014
  6. 1/2 rebase--am: use --cherry-pick instead of --ignore-if-in-upstreamJohn Keeping, Jul 15, 2014
  7. 2/2 rebase: omit patch-identical commits with --fork-pointJohn Keeping, Jul 15, 2014
  8. Ted FelixJul 15, 2014
  9. Junio C HamanoJul 15, 2014
  10. 1/2 rebase--am: use --cherry-pick instead of --ignore-if-in-upstreamJohn Keeping, Jul 16, 2014
  11. 2/2 rebase: omit patch-identical commits with --fork-pointJohn Keeping, Jul 16, 2014
  12. Junio C HamanoJul 16, 2014
  13. John KeepingJul 16, 2014
  14. Ted FelixJul 16, 2014
  15. John KeepingJul 17, 2014

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.