Re: Rebase options via git pull

2 messages, 2 authors, 2021-05-17 · open the first message on its own page

Re: Rebase options via git pull

From: Sergey Organov <hidden>
Date: 2021-05-17 12:33:29

Ævar Arnfjörð Bjarmason [off-list ref] writes:
On Fri, May 14 2021, Sergey Organov wrote:
quoted
Đoàn Trần Công Danh [off-list ref] writes:
quoted
On 2021-05-13 18:49:03-0600, Alex Henrie [off-list ref] wrote:
quoted
On Thu, May 13, 2021 at 7:23 AM Sergey Organov [off-list ref] wrote:
quoted
Hello,

Is there a way to specify additional options for "git rebase" when it's
invoked via:

  git pull --rebase

? What if rebase is used implicitly due to "pull.rebase" being set
accordingly?

In particular, I'd like to be able to:

  git pull --rebase --no-fork-point

but it doesn't work.
It would be cumbersome, but you could run `git config rebase.forkPoint
false` before pulling and `git config rebase.forkPoint true` after.
Or, for this *specific* case:

	git -c rebase.forkpoint=false pull --rebase
That's nice, thanks! Doesn't solve entire issue, but definitely better
than nothing.

Probably add generic cmd.<cmd>.opts config support, so that I can say:

  git -c cmd.rebase.opts="--no-fork-point --empty=keep" pull --rebase

Thoughts?
It's been discussed before (but I did not dig up the discussions,
sorry). It's been considered a bad idea, because our commands are a
mixture of plumbing/porcelain commands and switches, so we want to be
able to reliably invoke say ls-tree with some switches internally,
without config tripping us up.

Of course we could make this sort of thing work by selectively ignoring
the config, but such a thing would be equal in complexity to the effort
of assering that it's safe to introduce new rebase.* config in the
codebase for every switch it has now, but with a less friendly interface
both for git itself and users.
I don't see much complexity here. We'd then just need to effectively
invoke ls-tree internally like this:

   git -c 'cmd.ls-tree.opts=' ls-tree

Not a big deal.
I.e. instead of rebase.noForkPoint=<bool> we'd need to to getopt parsing
on some cmd.rebase.opts string.
As this is meant to be generic, then yes, every command will first parse
corresponding config option, then command-line options, rebase not being
any different.
I don't see why in this case what I suggested elsewhere in the thread
wouldn't be viable, i.e. you specify --rebase or --merge to "pull", and
that affects how we interpret the rest of the options. I haven't tried
it though, so there may be hidden gotchas there I haven't thought of.
This is the best solution for "git pull" indeed, but the above is a
generic feature that could provide solution in cases like this, where
immediate specific solution is not (yet) available.

Thanks,
-- Sergey Organov

Re: Rebase options via git pull

From: Đoàn Trần Công Danh <hidden>
Date: 2021-05-17 12:42:11

On 2021-05-17 15:33:18+0300, Sergey Organov [off-list ref] wrote:
quoted
quoted
Probably add generic cmd.<cmd>.opts config support, so that I can say:

  git -c cmd.rebase.opts="--no-fork-point --empty=keep" pull --rebase

Thoughts?
It's been discussed before (but I did not dig up the discussions,
sorry). It's been considered a bad idea, because our commands are a
mixture of plumbing/porcelain commands and switches, so we want to be
able to reliably invoke say ls-tree with some switches internally,
without config tripping us up.

Of course we could make this sort of thing work by selectively ignoring
the config, but such a thing would be equal in complexity to the effort
of assering that it's safe to introduce new rebase.* config in the
codebase for every switch it has now, but with a less friendly interface
both for git itself and users.
I don't see much complexity here. We'd then just need to effectively
invoke ls-tree internally like this:

   git -c 'cmd.ls-tree.opts=' ls-tree

Not a big deal.
It's a big deal.

Scripts was written with plumbing command and expect stable output.
If such change can be accepted, a lot of scripts will begin to fail.
quoted
I.e. instead of rebase.noForkPoint=<bool> we'd need to to getopt parsing
on some cmd.rebase.opts string.
As this is meant to be generic, then yes, every command will first parse
corresponding config option, then command-line options, rebase not being
any different.
quoted
I don't see why in this case what I suggested elsewhere in the thread
wouldn't be viable, i.e. you specify --rebase or --merge to "pull", and
that affects how we interpret the rest of the options. I haven't tried
it though, so there may be hidden gotchas there I haven't thought of.
I didn't follow that sub-thread. However, I think we can extend
git-pull with a dedicated option prefix for options that would be
passed down to git-merge or git-rebase.
Sililar to -W of CCLD (as in gcc -W,--as-needed)

-- 
Danh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help