https://github.com/cilium/cilium
Revision 4ddb158e2189fd4298d8adb92200b6937122cb5f authored by Paul Chaignon on 16 June 2021, 22:13:33 UTC, committed by Ilya Dmitrichenko on 24 June 2021, 09:29:22 UTC
When listing the commits of pull requests to backport, GitHub doesn't
offer a way to find the corresponding commits merged in master. We
therefore have to do it manually. To that end, we first retrieve a
candidate commit by matching on the exact commit title. Several commits
can have the same title however, so we need another check to confirm the
candidate commit is the same commit as the pull request's.

We currently use 'git patch-id' for the second check. That command
computes a unique ID for a patch. It can however have false negatives.
For example, 9515d1e ("docs: add a reference of helm values") and de62fa3
("docs: add a reference of helm values") refer to the same patch, the
first being from the pull request and the second from master (i.e., once
merged). Nevertheless, when we run 'git patch-id', we get two different
IDs:

    $ git show 9515d1e | git patch-id
    5d928411d72fcdb5c9c24ab2138896e6709e578c 9515d1ea37f1d1122ece73cf061cf47590e90f9e
    $ git show de62fa3 | git patch-id
    de14f63774d0f56ecc1e22db615987bedffe1e4b de62fa37c9ac679fd45bb617e8759dd7a4918ccb

Comparing the two commits shows that the difference is actually due to
changes not introduced by this commit:

    $ diff <(git show 9515d1e) <(git show de62fa3)
    [...]
    1997,1998c1997,1998
    < @@ -118,7 +118,7 @@ contributors across the globe, there is almost always someone available to help.
    <  | debug.enabled | bool | `false` | Enable debug logging |
    ---
    > @@ -119,7 +119,7 @@ contributors across the globe, there is almost always someone available to help.
    >  | disableEndpointCRD | string | `"false"` | Disable the usage of CiliumEndpoint CRD |
    [...]

We however don't need to use 'git patch-id'. Using the author's email
address and date (+ commit title) is usually enough to uniquely identify
commits on master. If someone sends two commits with the same title and
author date (to the second), then they are definitely trying to game the
system. In that unlikely event, we have two rounds of reviews (original
pull request and backport pull request) to catch it.

This commit implements that change. "%ae%at" (author email followed by
author date without spaces) is used as the commit ID instead of the ID
generated by git patch-id.

Signed-off-by: Paul Chaignon <paul@cilium.io>
1 parent 04def89
History
Tip revision: 4ddb158e2189fd4298d8adb92200b6937122cb5f authored by Paul Chaignon on 16 June 2021, 22:13:33 UTC
contrib: Identify upstream commits by author and date
Tip revision: 4ddb158
File Mode Size
.github
.travis
Documentation
api
bpf
bugtool
cilium
cilium-health
clustermesh-apiserver
contrib
daemon
envoy
examples
hack
hubble-relay
images
install
jenkinsfiles
operator
pkg
plugins
proxylib
test
tests
tools
vendor
.authors.aux -rw-r--r-- 416 bytes
.gitattributes -rw-r--r-- 211 bytes
.gitignore -rw-r--r-- 1.5 KB
.gitmodules -rw-r--r-- 0 bytes
.golangci.yaml -rw-r--r-- 3.3 KB
.mailmap -rw-r--r-- 3.5 KB
.travis.yml -rw-r--r-- 1.1 KB
AUTHORS -rw-r--r-- 18.8 KB
CODEOWNERS -rw-r--r-- 12.5 KB
CODE_OF_CONDUCT.md -rw-r--r-- 2.2 KB
CONTRIBUTING.md -rw-r--r-- 227 bytes
FURTHER_READINGS.rst -rw-r--r-- 4.9 KB
GO_VERSION -rw-r--r-- 7 bytes
LICENSE -rw-r--r-- 11.1 KB
MAINTAINERS.md -rw-r--r-- 3.6 KB
Makefile -rw-r--r-- 27.6 KB
Makefile.defs -rw-r--r-- 6.0 KB
Makefile.docker -rw-r--r-- 6.1 KB
Makefile.quiet -rw-r--r-- 718 bytes
README.rst -rw-r--r-- 15.1 KB
SECURITY.md -rw-r--r-- 615 bytes
USERS.md -rw-r--r-- 7.0 KB
VERSION -rw-r--r-- 8 bytes
Vagrantfile -rw-r--r-- 12.8 KB
go.mod -rw-r--r-- 5.4 KB
go.sum -rw-r--r-- 140.2 KB
netlify.toml -rw-r--r-- 92 bytes
stable.txt -rw-r--r-- 8 bytes
vagrant_box_defaults.rb -rw-r--r-- 392 bytes

README.rst

back to top