git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: skillzero@gmail.com
To: Jon Smirl <jonsmirl@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Figuring out which patches have been applied
Date: Fri, 2 Oct 2009 12:16:00 -0700	[thread overview]
Message-ID: <2729632a0910021216v7b3c5dadi14a6f8c0ea41b6b9@mail.gmail.com> (raw)
In-Reply-To: <9e4733910910020736n539f4331nfd61175b275c7d28@mail.gmail.com>

On Fri, Oct 2, 2009 at 7:36 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> I have a stack of 100 patches against 2.6.30. A lot of these got
> merged between 2.6.30-32.  How can I tell which ones have been
> applied?
>
> It doesn't work to check if patch A has been applied to 2.6.32. Other
> patches may have been applied on top of patch A obscuring it.
>
> Once solution would be to rebase the patch stack forward one commit at
> a time. That solves the problem of later patches obscuring patch A. Is
> there a better way to do this?

There may be a better way, but I needed to do a similar thing with
commits that were cherry-pick'd so I wrote a simple
git-contains-equivalent script to search for equivalent patch ID's
given a commit ID. You could do something like that, but using
git-patch-id as the source instead getting it from an existing commit
like the following script does.

#!/bin/bash

set -o pipefail
searchCommitID=`git rev-parse $1`
searchPatchID=`git show $searchCommitID | git patch-id`
if [ $? -ne 0 ]; then
	exit 1
fi
searchPatchID=${searchPatchID% *}

echo "Searching for equivalents to commit $searchCommitID (patch
$searchPatchID)..."
git log --all -p | git patch-id | grep $searchPatchID |
while read patchID commitID; do
	if [ "$commitID" = "$searchCommitID" ]; then
		echo "Exact commit $commitID is on the following branches:"
	else
		echo "Equivalent commit $commitID is on the following branches:"
	fi
	git branch -a --contains $commitID
done

      parent reply	other threads:[~2009-10-02 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02 14:36 Figuring out which patches have been applied Jon Smirl
2009-10-02 18:45 ` Julian Phillips
2009-10-02 19:16 ` skillzero [this message]

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=2729632a0910021216v7b3c5dadi14a6f8c0ea41b6b9@mail.gmail.com \
    --to=skillzero@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@gmail.com \
    /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 NNTP newsgroup(s).