From: Derrick Stolee Date: Mon, 30 Mar 2020 12:13:32 GMT Subject: Re: [PATCH v3] rebase --merge: optionally skip upstreamed commits Message-ID: In-Reply-To: <20200330040621.13701-1-jonathantanmy@google.com> On 3/30/2020 12:06 AM, Jonathan Tan wrote: > When rebasing against an upstream that has had many commits since the > original branch was created: > > O -- O -- ... -- O -- O (upstream) > \ > -- O (my-dev-branch) > > it must read the contents of every novel upstream commit, in addition to > the tip of the upstream and the merge base, because "git rebase" > attempts to exclude commits that are duplicates of upstream ones. This > can be a significant performance hit, especially in a partial clone, > wherein a read of an object may end up being a fetch. > > Add a flag to "git rebase" to allow suppression of this feature. This > flag only works when using the "merge" backend. So this is the behavior that already exists, and you are providing a way to suppress it. However, you also change the default in this patch, which may surprise users expecting this behavior to continue. > This flag changes the behavior of sequencer_make_script(), called from > do_interactive_rebase() <- run_rebase_interactive() <- > run_specific_rebase() <- cmd_rebase(). With this flag, limit_list() > (indirectly called from sequencer_make_script() through > prepare_revision_walk()) will no longer call cherry_pick_list(), and > thus PATCHSAME is no longer set. Refraining from setting PATCHSAME both > means that the intermediate commits in upstream are no longer read (as > shown by the test) and means that no PATCHSAME-caused skipping of > commits is done by sequencer_make_script(), either directly or through > make_script_with_merges(). > > Signed-off-by: Jonathan Tan > Signed-off-by: Junio C Hamano > --- > This commit contains Junio's sign-off because I based it on > jt/rebase-allow-duplicate. > > This does not include the fix by Đoàn Trần Công Danh. If we want all > commits to pass all tests (whether run by Busybox or not) it seems like > we should squash that patch instead of having it as a separate commit. > If we do squash, maybe include a "Helped-by" with Đoàn Trần Công Danh's > name. > > Junio wrote [1]: > >> Sounds much better to me. I do not mind --[no-]keep-cherry-pick, >> either, by the way. I know I raised the possibility of having to >> make it non-bool later, but since then I haven't thought of a good >> third option myself anyway, so... > > In that case, I think it's better to stick to bool. This also means that > the change from the version in jt/rebase-allow-duplicate is very small, > hopefully aiding reviewers - mostly a replacement of > --skip-cherry-pick-detection with --keep-cherry-pick (which mean the > same thing). > > [1] https://lore.kernel.org/git/xmqq4kuakjcn.fsf@gitster.c.googlers.com/ > --- > Documentation/git-rebase.txt | 21 +++++++++- > builtin/rebase.c | 7 ++++ > sequencer.c | 3 +- > sequencer.h | 2 +- > t/t3402-rebase-merge.sh | 77 ++++++++++++++++++++++++++++++++++++ > 5 files changed, 107 insertions(+), 3 deletions(-) > > diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt > index 0c4f038dd6..f4f8afeb9a 100644 > --- a/Documentation/git-rebase.txt > +++ b/Documentation/git-rebase.txt > @@ -318,6 +318,21 @@ See also INCOMPATIBLE OPTIONS below. > + > See also INCOMPATIBLE OPTIONS below. > > +--keep-cherry-pick:: > +--no-keep-cherry-pick:: I noticed that this _could_ have been simplified to --[no-]keep-cherry-pick:: but I also see several uses of either in our documentation. Do we have a preference? By inspecting the lines before a "no-" string, I see that some have these two lines, some use the [no-] pattern, and others highlight the --no-