Washing GitHub emails to include inline patch?

William Casarin jb55 at jb55.com
Thu Oct 12 23:03:12 PDT 2017


Kyle Meyer <kyle at kyleam.com> writes:

> Looking at what I wrote again, I'd change DONT-FETCH to FORCE-FETCH and
> then do something like
>
>     (when (or force-fetch
>               (not (magit-ref-exists-p local-ref)))
>       (magit-call-git "fetch" "origin"))
>
> where local-ref is bound to "refs/pull/origin/<pr>".  That way, "git
> fetch" is only called if the ref doesn't already exist locally or when a
> prefix argument is given, which would be useful for forced updates.

Oh, good call.

>> -    (magit-log (list (concat "master..refs/pull/origin/" pr)))))
>> +    (magit-log (list (concat "origin/master..refs/pull/origin/" pr)))))
>
> Anyway, it's nice to see that you've been able to modify this into
> something that might be useful to you.

Indeed, thanks again.

The last piece of the puzzle is the origin/master branch isn't always
the base branch it's merging into. I believe the proper way to do this
is like so. First we add another set of refs to fetch in our .git/config:

    [remote "origin"]
      fetch = +refs/pull/*/merge:refs/merge/origin/*

Now we can use this to get the base branch for the PR:

    refs/merge/origin/100^..refs/pull/origin/100

Which returns the proper set of commits.


Cheers,


-- 
https://jb55.com


More information about the notmuch mailing list