From c206e64a012ec26ef98d40697323a1a5fe6484e5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 16 Jan 2018 11:49:15 +0100 Subject: syz-ci: use the original syzkaller commit for patch testing Currently we use the latest syzkaller commit that syz-ci uses itself. As the result syz-execprog can fail to deserialize the reproducer. Use the original syzkaller commit. --- pkg/git/git.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/git') diff --git a/pkg/git/git.go b/pkg/git/git.go index 9930b449a..3ddfb3aed 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -72,6 +72,23 @@ func Checkout(dir, repo, branch string) (string, error) { return HeadCommit(dir) } +// CheckoutCommit checkouts the specified repository/branch/commit in dir. +func CheckoutCommit(dir, repo, branch, commit string) error { + if _, err := runSandboxed(dir, "git", "reset", "--hard"); err != nil { + if err := initRepo(dir); err != nil { + return err + } + } + _, err := runSandboxed(dir, "git", "fetch", repo, branch) + if err != nil { + return err + } + if _, err := runSandboxed(dir, "git", "checkout", commit); err != nil { + return err + } + return nil +} + func clone(dir, repo, branch string) error { if err := initRepo(dir); err != nil { return err -- cgit mrf-deployment