From: Junio C Hamano Date: Mon, 07 Jul 2014 17:56:23 GMT Subject: Re: [BUG] rebase no longer omits local commits Message-ID: In-Reply-To: <20140703222501.GF13153@serenity.lan> John Keeping writes: > 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.