diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-01-16 11:49:15 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-01-16 13:37:14 +0100 |
| commit | c206e64a012ec26ef98d40697323a1a5fe6484e5 (patch) | |
| tree | 638e9cab68717b656efc3ea3623be152c83a37c2 /pkg/git | |
| parent | afcb994770d7e0f4b88c623bec76fbdce57d3910 (diff) | |
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.
Diffstat (limited to 'pkg/git')
| -rw-r--r-- | pkg/git/git.go | 17 |
1 files changed, 17 insertions, 0 deletions
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 |
