Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Alejandro Colomar <alx@kernel.org>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: git-cherry-pick(1) -- path
Date: Fri, 10 May 2024 11:00:31 +0100	[thread overview]
Message-ID: <9b42e684-32e0-4372-8da6-40f9b708b6ca@gmail.com> (raw)
In-Reply-To: <kk244kap6lhuvtfot55u4yb5k5eddwlzl4izlzqhe4pdj52cx7@slghmpvdswkt>

Hi Alex and Junio

On 10/05/2024 10:05, Alejandro Colomar wrote:
> Hi Junio,
> 
> On Thu, May 09, 2024 at 06:15:24PM GMT, Junio C Hamano wrote:
>> Alejandro Colomar <alx@kernel.org> writes:
>>
>>> I'd be interested in being able to partially cherry-pick commits, based
>>> on a path filter (similar to how many other git(1) commands behave with
>>> -- path).
>>>
>>> Do you have any opinions on that?
I'd be happy to see a patch that adds that (I sometimes find myself 
wishing "git cherry-pick" had a "--patch" option to do something similar 
but that's a bit of a tangent here)

>>      $ git format-patch --stdout -1 $ThatCommit -- $ThisPath |
>>        git am -3
> 
> Hmmm, I hadn't thought of that; very interesting!
> 
> Although I have some concerns with git-am(1); basically that it's almost
> clueless when there's a conflict.

"git am -3" should be fine here as you're guaranteed to have the 
necessary blobs available to create conflicts - this is what "git rebase 
--apply" does.

> If I find some time, I'll check if I can program that (although it would
> be the first time I do some contribution like that to git(1), so I may
> need some help).  :-)

As far as the implementation goes I haven't thought too deeply but I 
suspect we'd want to create a couple of trees based on the commit we 
want to cherry-pick and its parent filtered by the pathspec and use 
those in the tree-way merge with HEAD.

Best Wishes

Phillip

  reply	other threads:[~2024-05-10 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 22:32 git-cherry-pick(1) -- path Alejandro Colomar
2024-05-10  1:15 ` Junio C Hamano
2024-05-10  9:05   ` Alejandro Colomar
2024-05-10 10:00     ` Phillip Wood [this message]
2024-05-10 17:03       ` Junio C Hamano
2024-05-11 11:46         ` Alejandro Colomar
2024-05-11 15:01           ` Phillip Wood
2024-05-11 20:08             ` Alejandro Colomar
2024-05-12 15:35               ` Alejandro Colomar
2024-05-13 15:16               ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b42e684-32e0-4372-8da6-40f9b708b6ca@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=alx@kernel.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).