From 8f3e774b76b4fb0955dc360bb82d66a2c4bb3b39 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 7 Nov 2017 13:30:25 +0100 Subject: syz-ci: improve commit matching 1. Fetch last 200K commits instead of commits for past year. For merged commits both author date and commit date can be arbitrary long in past (e.g. we got a commit dated by 2014). 2. Strip some commit prefixes from commits. We have some trees where backports are prefixed with "BACKPORT:". Previously we could no match such commits. --- pkg/git/git_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pkg/git/git_test.go (limited to 'pkg/git/git_test.go') diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go new file mode 100644 index 000000000..42d2d3a07 --- /dev/null +++ b/pkg/git/git_test.go @@ -0,0 +1,23 @@ +// Copyright 2017 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package git + +import ( + "testing" +) + +func TestCanonicalizeCommit(t *testing.T) { + tests := map[string]string{ + "foo bar": "foo bar", + " foo ": "foo", + "UPSTREAM: foo bar": "foo bar", + "BACKPORT: UPSTREAM: foo bar": "UPSTREAM: foo bar", + } + for in, want := range tests { + got := CanonicalizeCommit(in) + if got != want { + t.Errorf("input %q: got %q, want %q", in, got, want) + } + } +} -- cgit mrf-deployment