Re: Washing GitHub emails to include inline patch?

Subject: Re: Washing GitHub emails to include inline patch?

Date: Thu, 12 Oct 2017 23:03:12 -0700

To: Kyle Meyer

Cc: notmuch@notmuchmail.org

From: William Casarin


Kyle Meyer <kyle@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
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: