[llvm-dev] How to deal with multiple patches to the same file

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 10 07:07:17 PDT 2020



> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Paul C.
> Anagnostopoulos via llvm-dev
> Sent: Monday, August 10, 2020 9:30 AM
> To: llvm-dev at lists.llvm.org
> Subject: [llvm-dev] How to deal with multiple patches to the same file
> 
> I have submitted a patch to Phabricator that includes the TableGen file
> TGparser.cpp. Now I want to fix a bug in that file. What is the proper
> procedure so that the two patches don't get screwed up, either in my
> repository or in the master repository? Please answer as if I'm a
> git/Phabricator idiot, because, well, I am.
> 
> I should note that all I did in my repository for the first patch was
> stage the files and then do a diff --staged. Those files remain staged
> because I'm not sure what to do with them given that we use Phabricator
> and not pull requests.

(I'm not completely giving you recipes; if you need more explicit steps
then let me know and I'll do a full-on example.)

Even though we don't use pull requests, I still tend to commit my patches
to branches off of master, in my local clone.  This allows `git show` to
generate the diff.  As master advances, you update your master branch and
then on the patch branch, a simple `git rebase master` updates it.

Assuming the patch is approved, on master you can `git merge --ff-only`
to move the patch to your local master, and then push it from there.

If the bugfix is not near your other changes, and can be made independently,
then you can treat it as a fully independent patch on its own branch.

If the bugfix is near your other changes or is dependent on it, then I'd
create a second patch branch based on the first patch branch.  As before,
`git show` generates the diff, and in Phabricator there's a way to mark
the second patch as dependent on the first patch.  I haven't done this
personally so I'm unclear about the exact steps, but I see people doing
"patch series" all the time.

HTH and again let me know if you need a more explicit example.
--paulr

> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list