stgit icon indicating copy to clipboard operation
stgit copied to clipboard

RFE: allow --3way mode for `stg import`

Open jnsnow opened this issue 6 years ago • 4 comments

--reject is nice, but I often like to try --3way first.

(Use case is using stg to load patchsets from QEMU mailing list as a stack for review purposes. Sometimes the patches are slightly out of date and --3way or --reject is needed to get the patches loaded.)

I could likely write a patch to just "plumb" a --3way option through, but I was wondering if a more general purpose solution for passing "arbitrary" arguments to git apply would be wanted instead, or if "the stupid approach" here was actually best. It might also be nice, because mbox files can have multiple patches within them, to allow the --interactive mode, too.

Please advise! --js

jnsnow avatar Aug 15 '19 19:08 jnsnow

The case for --3way makes sense to me.

Regarding passing arbitrary options to git apply, I personally do not prefer that approach. Stgit has this kind of arbitrary option pass-through with --diff-opts on several subcommands (diff, show, edit, ...).

One of the problems is CLI discoverability. Stgit's help does not present the user with all the valid/useful diff options. This could be solved with more documentation.

Another problem is that it becomes unclear/opaque as to how user-selected diff options interact with stgit's default diff options. I.e. how does the user know which ones stgit already applies? Or what the behavior will be when a user-provided option conflicts with a stgit default option?

Lastly, it makes the stgit code more complex because in order to have reasonable behaviors when a user-provided option conflicts with stgit's default option set, stgit has to first parse the user's pass-through options and then resolve the conflict somehow. At this point, we are already baking-in knowledge about git's options, so why not explicitly enumerate the useful options as part of stgit's interface?

Anyway, I would be open to a patch to add the --3way option to stg import, along with potentially other options that map to useful git apply modes/options, but I'd need to be sold on the general-purpose pass-through.

jpgrayson avatar Aug 19 '19 21:08 jpgrayson

OK, I wasn't sure if there would be pushback to a parade of new options, but I can route a --3way option for now and leave something more generic/powerful for another day.

Thank you and sorry for the deluge of issues/emails; but I am very excited to see activity on stgit, which is a tool I love dearly :)

jnsnow avatar Aug 20 '19 13:08 jnsnow

Another option that I'd be interested in from git-apply is --directory.

The repository I'm importing to doesn't have the same base path as the repository I'm importing from. I'm ok that the generated patches would have different paths. Having this option would help bootstrap the process using stgit instead of manually using git am and git apply.

wberrier avatar May 20 '20 20:05 wberrier

Trying to backport https://patchwork.kernel.org/project/linux-pci/cover/[email protected]/ on older kernel, I was reminded stg import --3way sure would be nice.

lkraav avatar Apr 08 '22 16:04 lkraav