aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/vcs: be more strict in BaseForDiffAleksandr Nogikh2026-01-161-4/+12
| | | | | | | | | | Do not tolerate unknown blob hashes - it means that we are unable to find the correct base commit given the repository. Explicitly ignore newly added files - we definitely won't find their hashes. Explicitly skip malformed patches that won't have any blob hashes - otherwise we could end up with too many candidates and waste too much time.
* pkg/vcs: return multiple base commit candidatesAleksandr Nogikh2026-01-131-16/+51
| | | | | Return the commits that represent unique sets of branches. Sort the list topologically, breaking ties by commit date.
* pkg/vcs: find base commit by blob sha hashesAleksandr Nogikh2026-01-091-0/+180
| | | | | | Given a git diff, determine the latest commit where the modified files still have the exact sha hashes they had at the moment the git patch was created.
* pkg/vcs: extend ParseGitDiffAleksandr Nogikh2026-01-091-6/+24
| | | | Return not just the modified files, but also their blob hashes.
* pkg/vcs: don't re-clone on network errorsAleksandr Nogikh2025-06-171-2/+10
| | | | | | | | | | | | | | | | There's no sense to react to `git checkout` or `git fetch` which failed due to network problems by re-cloning the whole repository - that operation will fail just as well. Detect at least one kind of such problems and just return an error from the Poll() method, without wiping everything out. For now, don't add tests as we would need some real remote git server implementation to properly test it. Using a folder as a "remote" repository, like we do in other tests, won't ever trigger networking errors. Closes #6099.
* pkg/vcs: extend ListCommitHashesAleksandr Nogikh2025-05-131-9/+22
| | | | | | | | | | Rename the method to LatestCommit and make it more flexible: 1) Return the commit date alongside the commit hash. 2) Rename the time filter to highlight that it's non-inclusive. 3) Make it possible to query the commits newer than the specified commit hash. It will let us poll lore archives more efficiently.
* pkg/vcs: export GitWrapperAleksandr Nogikh2025-01-091-180/+216
| | | | | | | | | | | | | The current common vcs interface and its implementations are designed to support a very big number of situations (git modules, cleaning up complex state, etc), which is too heavy and restrictive when we just need a thin wrapper over the git command that supports a few basic operations. Refactor pkg/vcs to split out the wrapper code from the big git implementation of the vcs.Repo interface. Export the wrapper to enable reuse in other parts of the system.
* pkg/vcs: extend ListCommitHashesAleksandr Nogikh2025-01-031-2/+9
| | | | Support filtering by the commit date.
* pkg/vcs: parse git diffsAleksandr Nogikh2024-10-251-0/+11
| | | | Provide a functionality to extract the files affected by a git patch.
* pkg/vcs: expose commit patchDmitry Vyukov2024-10-151-2/+16
| | | | Add Commit.Patch with patch body.
* pkg/vcs: change HeadCommit to CommitDmitry Vyukov2024-10-151-16/+12
| | | | | | | Currently we have HeadCommit function that returns info about the HEAD commit. Change it to a more flexible Commit function that can return info about any commit. This will be used in future changes.
* syz-ci: introduce gitArchive parametersTaras Madan2024-10-101-0/+9
| | | | | | | Some commits don't live long remotely. It sometimes happens we need them later to: 1. Merge coverage. 2. Mention during communication.
* pkg/covermerger: optimize checkoutsTaras Madan2024-08-291-0/+16
| | | | | Every commit checkout takes >3 seconds. Let's optimize this operation to save on large merges.
* pkg/vcs: support fetches by a short git hashAleksandr Nogikh2024-03-051-2/+5
| | | | | | | | | | | | The approach we used works perfectly for all commits, but they must be referenced by the full 40 character hash. In almost all cases, users would prefer to use the shorter one. If the commit hash is not 40 characters long, fetch the whole git tree. The only unsupported scenario is fetching a commit that is referenced by custom refs/* by its short hash. It's unlikely there's anything we can do here.
* pkg/vcs: make git fetch calls more specificAleksandr Nogikh2024-01-171-3/+7
| | | | | | | | | This should make syzkaller only fetch the commits relevant for further processing. Also, specifying the exact commit/branch name to fetch allows us to access commits from custom refs. Test the new behaviour and double-check that remote tags fetch was not broken.
* pkg/vcs: delete ListRecentCommits()Aleksandr Nogikh2023-12-201-11/+0
| | | | It's not needed anymore.
* pkg/vcs: circumvent ref conflicts during fetchAleksandr Nogikh2023-08-301-0/+13
| | | | | | | | | | If the remote repo's tags conflict with the local ones, `git fetch` may fail with `error: cannot lock ref %: % exists`. It seems that the only way to restore the repository in this case is to do `git fetch` with `--prune --prune-tags`. Since this also forces the repository to forget all tags not present in the remote, let's do it only when we got the error message.
* all: use special placeholder for errorsTaras Madan2023-07-241-5/+5
|
* pkg/vcs: force git branch checkoutLiz Prucka2023-06-151-3/+9
| | | | | | | | | | | | | | We are currently seeing errors that there are "untracked working tree files which would be overrwritten by checkout". This error occurs when files of the same path differ between branches, regardless of whether the repository is clean or not. Forcing FETCH_HEAD checkout, then moving repair() to after checkout to clean repository to the current checkout. Additionally, added a second "force" to git clean to clean directories with '.git' subdirectories.
* pkg/vcs: extract merge bases of two commitsAleksandr Nogikh2023-04-281-0/+16
|
* pkg/vcs: lengthen command timeoutLiz Prucka2023-04-191-1/+1
| | | | | The Pixel repository from partner-android takes ~2 hours to initialize, so increased the git command timeout to 3 hours.
* pkg/vcs: add two more vcs.Repo methodsAleksandr Nogikh2023-04-061-0/+12
| | | | | | | 1) ListCommitHashes, which lists all commit hashes reachable from the specified commit. 2) Object, which allows to query the contents of an object at the specified revision.
* pkg/vcs: git clean submodulesLiz Prucka2023-02-031-2/+3
| | | | | | | | | | | When changing branches, we were receiving an error that submodules were not clean. Added recurse-submodules flag in git reset to recursively reset submodules. Additionally, added command to recursively clean each subdirectory.
* pkg/vcs/git.go: fixed error in initializing submodulesLiz Prucka2022-08-111-1/+6
| | | | Adding a remote origin if one has not been initialized.
* pkg/vcs/git: fetch commits not older than five yearsAlexander Egorenkov2022-05-101-2/+6
| | | | | | | | | | Increase the maximum age of fetched commits when searching for fix tags and commit titles. This enables syz-ci to find older commits provided with '#syz fix' commands. https://groups.google.com/g/syzkaller/c/nbd2tUr5AhU Signed-off-by: Alexander Egorenkov <eaibmz@gmail>
* pkg/vcs: recursively clone git submodulesKris Alder2022-04-221-0/+9
| | | | | | | | | | | | Android kernel source uses Git submodules to separate vendor- or device-specific kernel modules from the main kernel source. This calls 'git submodules update --init' after calls to 'git checkout', which is the equivalent of adding the '--recurse-submodules' flag to 'git clone'. For cases where submodules aren't used (all other Syzkaller targets) this additional command is a no-op.
* pkg/vcs: add repo.Contains methodDmitry Vyukov2020-12-251-0/+5
| | | | | | Returns true if the current tree contains the specified commit (the commit is reachable from the current HEAD). Cntains(commit string) (bool, error)
* pkg/kconfig: store minimization resultsJouni Hogander2020-12-101-4/+5
| | | | | Store config options identified using DebugTracer. Also change bisection and configuration minimization code to use new DebugTracer.
* pkg/vcs: use --force with git fetchDmitry Vyukov2020-12-101-3/+3
| | | | | | | | | | | | | | git fetch can fail due to force-recreated tags: > ! [rejected] ext4_for_linus -> ext4_for_linus > (would clobber existing tag) And due to something related to updating local branches (see 'git help fetch' for details). --force should avoid both issues and it seems that we always want force for our purposes (rather than fail update/patch testing).
* pkg/vcs/git: optimize CheckoutBranchAlexander Egorenkov2020-11-201-1/+4
| | | | | | | | | | | | | | | | | Fetching a remote branch w/o the corresponding remote with git disables delta optimization on the server's side and the git client is forced to download the complete branch even if it already has got an older version. This leads to several problems as: * Long fetch time * Limitless growth of local git repo due to git fetch creating a new pack file every time Create a remote before fetching to fix the above issues. With a remote, only the first fetch will take some time and all the following ones shall be very fast. Furthermore, git fetch will avoid creating many pack files in .git/objects/pack. Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
* tools/syz-kconf: detect -rcN tagsDmitry Vyukov2020-10-291-6/+6
| | | | | | We currently detect v5.10-rc1 as v5.9 because we ignore -rc tags. This makes it impossible to enable configs that were already added for v5.10. Treat v5.10-rc1 as v5.10 already.
* pkg/vcs: add repo OptPrecious and OptDontSandbox optionsDmitry Vyukov2020-10-211-18/+38
| | | | | | | | | | The pkg/vcs code assumed that we fully manage the repo within an autonomous program. In particular it tried to repair any errors by dropping and re-creating the repo. This does not work well for command-line tools that work with a user-provided repo. Add OptPrecious for such uses. Update #2171
* pkg/vcs: add ReleaseTagDmitry Vyukov2020-10-211-10/+21
| | | | | | | Add ReleaseTag method that returns last release tag for the given commit. Update #2171
* pkg/vcs: use committer dateTetsuo Handa2020-10-101-4/+9
| | | | | | | | The Freshness columns in Instances: table on the dashboard page look outdated, for these fields are showing when that patch was authored. Where possible, using when that patch was committed into the tree in question would be more meaningful. Update #1537
* pkg: get and store Maintainers dataPedro Lopes2020-07-311-8/+8
| | | | | | Create a struct on pkg/vcs to store data of syzkaller email recipients and update its users. The struct contains default name, email, and a label to divide user into To and Cc when sending the emails.
* pkg/vcs: don't sandbox syzkaller repoDmitry Vyukov2020-07-121-5/+19
| | | | | | | | | | | | | | | | | | | Currently we sandbox all repos b/c we assumed that all builds are also sandboxes. But this causes havoc for bisection/patch testing b/c syzkaller build is not actually sandboxed anywhere. Build creates root-owned files and then git can't do anything with them but don't report errors either: $ git checkout 8eda0b95 && echo OK error: unable to unlink old 'sys/linux/gen/386.go': Permission denied error: unable to unlink old 'sys/linux/gen/ppc64le.go': Permission denied ... HEAD is now at 8eda0b957e5b OK We trust own sources and we don't test syzkaller patches, so don't sandbox syzkaller repos.
* pkg/vcs: reset state even moreDmitry Vyukov2020-07-041-1/+2
| | | | | | "git clean -fd" does not remove ignored files, while can mess state when .gitignore changes across commits. Use "git clean -fdx" to delete ignored files as well.
* pkg/vcs: run git clean with switching commitsDmitry Vyukov2020-05-251-0/+1
| | | | | Maybe it will help to fix: https://groups.google.com/forum/#!topic/syzkaller-bugs/2lgvlHd8t1c
* pkg/vcs: always extract tags from subjectDmitry Vyukov2020-05-181-15/+2
|
* pkg/vcs: Unset various git environment variables when invoking gitAndrew Donnellan2019-12-121-1/+22
| | | | | | | | | | | | | | | | If you try to run git-using tests while the GIT_DIR environment variable (and GIT_WORK_TREE, etc) happens to be set, the tests are going to do fun and exciting things on a repository that isn't the test repository it tries to set up. As it turns out, if you try to run "make test" using git rebase -x, you'll end up with GIT_DIR set to the syzkaller tree. Hilarity ensues. Unset GIT_DIR, GIT_WORK_TREE and a few other environment variables when invoking git - that way it'll default to looking at the working directory that we have given it, which is what we expect. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
* dashboard/app: don't report bisections pointing to release commitsDmitry Vyukov2019-11-271-0/+12
| | | | | | | | | | | They should have been detected by "same binary" logic. But the problem is that we may use different compilers for different commits and they switch exactly at release commits. So we can build the release with a differnet compiler than the rest of commits and then obviously it won't be "same binary". Detect release commits separately. Update #1271
* pkg/bisect: detect wrong bisectionsDmitry Vyukov2019-11-071-3/+5
| | | | | | | | Detect bisection to merge commits and to commits that don't affect kernel binary (comments, other arches, whitespaces, etc). Such bisections are not reported in emails (but shown on web). Update #1271
* pkg/bisect: add initial testing support for cause bisectionZubin Mithra2019-10-221-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | (note: incomplete change) Refactor existing code as follows: * Move reusable test utility functions from git_repo_test.go to pkg/vcs/test_util.go and make them exported. * Split Run() into Run()+runImpl(). * Change type of bisect.go:env.inst to `instance.BuilderTester`. Change usage inside syz-testbuild/testbuild.go accordingly. * Move most of linux.PreviousReleaseTags() into vcs/git.go as git.previousReleaseTags(). * Allow build.CompilerIdentity to be mocked. Introduce the following changes: * instance.BuilderTester is an interface with methods BuildSyzkaller() BuildKernel() Test() NewEnv() now returns this interface. * type testEnv implements instance.BuilderTester. * type testBuilder implements builder interface. Add a entry into table inside pkg/build/build.go:getBuilder() to return testBuilder object.
* pkg/vcs: handle git commits without a bodyAnton Lindqvist2019-09-241-1/+15
| | | | | | | | | | OpenBSD uses cvs and does not enforce the standard Git convention for commit messages of putting a summary followed by a new line and body. If such commit[1] contains a `Reported-by` header, it's currently not detected. Instead, if the body is empty try to extract data from the commit summary. [1] https://github.com/openbsd/src/commit/bdbfbec5cea84d24d6a598cf1e63dbdb10e8331a
* pkg/vcs: wrap git invocations in a helper methodDmitry Vyukov2019-03-201-29/+30
| | | | | There is a bunch of repetition to invoke git. Wrap it into a helper method.
* pkg/vcs: reset repo moreDmitry Vyukov2019-03-171-7/+15
| | | | | | | | If we cherry-pick some fixes during bisection we need to "git reset" repo before "git bisect reset". Otherwise it will fail. Reset repo in more points. Update #501
* pkg/vcs: refactor bisection supportDmitry Vyukov2019-03-171-62/+58
| | | | | | | | | | | | | | | In preparation for syz-ci bisection: - move bisection function into a separate interface they look out of place in vcs.Repo because most OSes don't implement it and most users don't case - extract author name and more CC emails for commits - move linux-specific PreviousReleaseTags into linux.go - fix inconclusive bisection (more than 1 potential commits) - add tests fr bisection - add maintainers returned from get_maintainers.pl for commits that don't have enough emails (e.g. only author email) Update #501
* dashboard/app: poll commits infoDmitry Vyukov2019-02-171-43/+102
| | | | | | | | | | | | | | | This implements 2 features: - syz-ci polls a set of additional repos to discover fixing commits sooner (e.g. it can now discover a fixing commit in netfilter tree before it reaches any of the tested trees). - syz-ci uploads info about commits to dashboard. For example, a user marks a bug as fixed by commit "foo: bar". syz-ci will find this commit in the main namespace repo and upload commmit hash/date/author to dashboard. This in turn allows to show links to fixing commits. Fixes #691 Fixes #610
* pkg/vcs: fetch git tags when checking out particular commitDmitry Vyukov2019-01-041-1/+1
| | | | | | Fetch of a named remote does not seem to fetch all tags. This is a problem for linux-next as it contains lots of tags that are not on the main branch because of periodic rebases.
* pkg/vcs: don't use --no-tags when fetching gitDmitry Vyukov2018-12-171-1/+1
| | | | | | | pkg/bisect uses Poll and then relies on tags for compiler detection. Don't use --no-tags when fetching. Update #501