summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Fix shallow clones when upstream attribute is present"v2.58mainGavin Mak4 days1-6/+2
| | | | | | | | | | | | | This reverts commit d9cc0a15265299b6dcfc1d65f192fd14cfb17b02. Reason for revert: AttributeError: 'Project' object has no attribute 'use_superproject' Bug: b/427093249 Change-Id: I57b285ab21f58b040e68ec14b85425f43f0abcca Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498641 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* git_superproject: fix AttributeError in Superproject loggingGavin Mak4 days1-1/+2
| | | | | | | | | | | | | Ensure _git_event_log is initialized before use in _LogMessage. This avoids crashes when _git_event_log is accessed before it's set, such as during repo info. Bug: 435317391 Change-Id: I3adc32d6a9377558e852bbb43f9cf82041fcf1bc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498521 Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* sync: Fix missing error details in interleaved summaryGavin Mak4 days2-29/+27
| | | | | | | | | | | | | | When checkout errors occurred in interleaved sync, they were wrapped in a SyncError with no message, causing blank lines in the final summary. Refactor _SyncResult to hold a list of exceptions, ensuring the original error messages are propagated correctly. Bug: 438178765 Change-Id: Ic25e515068959829cb6290cfd9e4c2d3963bbbea Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498342 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* sync: Record and propagate errors from deferred actionsGavin Mak5 days3-16/+25
| | | | | | | | | | | | | Failures in deferred sync actions were not recorded because `_Later.Run` discarded the `GitError` exception. Record the specific error using `syncbuf.fail()` and propagate it for proper error aggregation and reporting. Bug: 438178765 Change-Id: Iad59e389f9677bd6b8d873ee1ea2aa6ce44c86fa Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498141 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* progress: Fix race condition causing fileno crashGavin Mak5 days1-7/+10
| | | | | | | | | A race condition occurs when sync redirects sys.stderr to capture worker output, while a background progress thread simultaneously calls fileno() on it. This causes an io.UnsupportedOperation error. Fix by caching the original sys.stderr for all progress bar IO. Change-Id: Idb1f45d707596d31238a19fd373cac3bf669c405 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498121 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* sync: Avoid duplicate projects in error textGavin Mak5 days1-13/+7
| | | | | | | | | | | | | Keep track of finished projects, not just successful ones, when deciding which projects still need to be synced. Also project errors are already reported by sync workers so stall detection doesn't need to add failed projects to the error list. Bug: 438178765 Change-Id: Ibf15aad009ba7295e70c8df2ff158215085e9732 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498062 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: always show sync result stderr_text on errorGavin Mak5 days1-1/+2
| | | | | | | | | | | _ProcessSyncInterleavedResults currently only shows stderr_text if verbose. Show it if a sync worker fails, regardless of verbosity. Bug: 438178765 Change-Id: If24dcb10fb5d6857386782d371e3f9c6844dece9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498061 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* Fix shallow clones when upstream attribute is presentKrzysztof Wesolowski14 days1-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The _CheckForImmutableRevision method was modified in commit 0e776a58 to include upstream branch validation for superproject scenarios. However, this change inadvertently broke shallow clones when both clone-depth and upstream attributes are specified in regular (non-superproject) manifests. Issue: When upstream is present, _CheckForImmutableRevision performs two additional checks: 1. git rev-list on the upstream reference 2. git merge-base --is-ancestor between revision and upstream In shallow clones, the upstream branch history may not be available locally, causing these checks to fail. This triggers the retry mechanism that removes depth limitations, effectively converting shallow clones to full clones, resulting in excessive disk usage. Fix: Make upstream validation conditional on superproject usage. This preserves the original superproject fix while restoring the method's original behavior for regular scenarios - checking only if the immutable revision (SHA1/tag) exists locally. Note: The SetRevisionId method from the same commit 0e776a58 is left unchanged as it only stores upstream information (no git operations), which is beneficial for preserving branch context for commands like 'repo start' without causing fetch-related issues. The fix ensures that manifests with both clone-depth and upstream work correctly in non-superproject scenarios, maintaining shallow clone efficiency and reducing disk usage. Bug: b/427093249 Change-Id: I00acd4c61b179cd2abf796c2fecb7a2f38016a18 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/493883 Tested-by: Krzysztof Wesolowski <krzysztof.wesolowski@volvocars.com> Commit-Queue: Krzysztof Wesolowski <krzysztof.wesolowski@volvocars.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Kamaljeet Maini <kamaljeet@google.com> Reviewed-by: Xin Li <delphij@google.com>
* project: fallback to reading HEAD when rev-parse failsv2.57.3stableGavin Mak2025-08-041-1/+22
| | | | | | | | | | | | | git rev-parse fails on invalid HEAD, e.g. after incomplete sync, causing NoManifestException. Fall back to v2.56's direct file reading when rev-parse fails. Bug: 435045466 Change-Id: Ia14560335110c00d80408b2a93595a84446f8a57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/495181 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* hooks: verify hooks project has worktree before runningv2.57.2Gavin Mak2025-07-281-3/+3
| | | | | | | | | | | Skip hook if its project is not present on disk. Bug: 434232630 Change-Id: I09a8b412d078af7a068d533f7be320d5b02327be Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/494441 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* sync: fix connection error on macOS for interleaved syncKuang-che Wu2025-07-281-0/+1
| | | | | | | | | | Bug: 377538810 Test: on macos, repo sync -j64 Change-Id: I6af4d4e6669dc882f165cbb9142ad4db9b346b73 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/494241 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Kuang-che Wu <kcwu@google.com> Tested-by: Kuang-che Wu <kcwu@google.com>
* project: Fix GetHead to handle detached HEADsGavin Mak2025-07-251-1/+5
| | | | | | | | | | | | | The switch to git rev-parse caused GetHead() to return the literal string 'HEAD' when in a detached state. This broke repo prune, which expects a commit SHA. Bug: 434077990 Change-Id: I80b7d5965749096b59e854f61e913aa74c857b99 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/494401 Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Don't checkout if no worktreev2.57.1Gavin Mak2025-07-232-43/+69
| | | | | | | | | | Interleaved sync should not try checkout out a project if it's a mirror. Change-Id: I2549faab197a3202d79a10e44b449b68d53e3fe7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/492942 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Default to interleaved modev2.57Gavin Mak2025-07-211-5/+14
| | | | | | | | | | | | | The previous default, "phased" sync (separate network and checkout phases), can now be selected with `--no-interleaved`. Bug: 421935613 Bug: 432082000 Change-Id: Ia8624daa609a28ea2f87f8ea4b42138d8b3e9269 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/489681 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* project: Use git rev-parse to read HEADGavin Mak2025-07-211-11/+3
| | | | | | | | | | | Don't directly read `.git/HEAD`, git already has a command for this. Bug: 432200791 Change-Id: Iba030650224143eb07c44da1fa56341d9deb4288 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/492941 Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Improve UI and error reporting for interleaved modeGavin Mak2025-07-172-2/+19
| | | | | | | | | | | | | This fixes two issues: 1. the progress bar could show a count greater than the total if new projects were discovered mid-sync. Update the progress bar total dynamically 2. Make "Stall detected" error message more actionable Bug: 432206932 Change-Id: Ie2a4ada5b1770cae0302fb06590641c522cbb7e7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/491941 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* project: Use plumbing commands to manage HEADGavin Mak2025-07-171-10/+3
| | | | | | | | | | | | Don't directly manipulate `.git/HEAD` since it bypasses Git's internal state management. Bug: 432200791 Change-Id: I1c9264bcf107d34574a82b60a22ea2c83792951b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/491841 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* progress: Make end() idempotentGavin Mak2025-07-021-0/+5
| | | | | | | | | | | This fixes the double "done" text on successful interleaved sync. Bug: 421935613 Change-Id: I4f01418cb0340129a8f0a2a5835f7e3fa6a6b119 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/487081 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* sync: support post-sync hook in <repo-hooks>Kenny Cheng2025-07-013-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for a new hook type "post-sync" declared in the manifest using <repo-hooks>. This allows executing a script automatically after a successful `repo sync`. This is useful for initializing developer environments, installing project-wide Git hooks, generating configs, and other post-sync automation tasks. Example manifest usage: <project name="myorg/repo-hooks" path="hooks" revision="main" /> <repo-hooks in-project="myorg/repo-hooks" enabled-list="post-sync"> <hook name="post-sync" /> </repo-hooks> The hook script must be named `post-sync.py` and located at the root of the hook project. The post-sync hook does not block `repo sync`; if the script fails, the sync still completes successfully with a warning. Test: Added `post-sync.py` in hook project and verified it runs after `repo sync` Bug: b/421694721 Change-Id: I69f3158f0fc319d73a85028d6e90fea02c1dc8c8 Signed-off-by: Kenny Cheng <chao.shun.cheng.tw@gmail.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/480581 Reviewed-by: Scott Lee <ddoman@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* init: Add environment variable for git-lfsMatt Moeller2025-06-301-0/+1
| | | | | | | | | | | | | | | | | | | | Convenient way to always enable or disable git-lfs without having to remember to put on the command line. Useful if you want to ALWAYS have git-lfs enabled on your system when you 'init' a new project. Also useful if you are using the Jenkins repo plugin as it doesn't provide an option for enabling git-lfs in its UI. Change-Id: Ieb1bbe83de9c21523ab69b30fc5047c257d02731 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/437661 Commit-Queue: Scott Lee <ddoman@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Fatahillah Wk <fatahillahwkwk@gmail.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Matt Moeller <moeller.matt@gmail.com> Reviewed-by: Yingchun Li <sword.l.dragon@gmail.com>
* sync: Share final error handling logic between sync modesv2.56Gavin Mak2025-06-231-27/+72
| | | | | | | | | | | | | | | Dedupe error reporting logic for phased and interleaved sync modes by extracting it into _ReportErrors. Error reporting will now distinguish between network and local failures and lists the specific repos that failed in each phase. Bug: 421935613 Change-Id: I4604a83943dbbd71d979158d7a1c4b8c243347d2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484541 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* sync: Share manifest list update logic between sync modesGavin Mak2025-06-231-30/+55
| | | | | | | | | | | | Extract the manifest update loop from _SyncPhased into a new _UpdateManifestLists method and use it in both sync types. Bug: 421935613 Change-Id: If499a3ce4a0bbb3c4641dba52ca5c1c82b11f16f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484341 Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Share self-update logic between sync modesGavin Mak2025-06-232-10/+160
| | | | | | | | | | | | | | | | The logic for checking for repo self-updates lives in _FetchMain, which is part of the "phased" sync path. Extract this logic into a new _UpdateRepoProject helper method. Call this common helper from _ExecuteHelper before either sync mode begins, so the repo self-update check is always performed. Bug: 421935613 Change-Id: I9a804f43fbf6239c4146be446040be531f12fc8a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484041 Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: clarify job flags when using interleavedGavin Mak2025-06-183-6/+9
| | | | | | | | | | | --jobs-network and --jobs-checkout are ignored with --interleaved. Bug: 421935613 Change-Id: Ib69413993c4f970b385bd09318972716e5ac3324 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/485021 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* sync: Implement --interleaved sync workerGavin Mak2025-06-183-114/+483
| | | | | | | | | | | | | | | | For each assigned project, the worker sequentially calls Sync_NetworkHalf and Sync_LocalHalf, respecting --local-only and --network-only flags. To prevent scrambled progress bars, all stderr output from the checkout phase is captured (shown with --verbose). Result objects now carry status and timing information from the worker for state updates. Bug: 421935613 Change-Id: I398602e08a375e974a8914e5fa48ffae673dda9b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/483301 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Add orchestration logic for --interleavedGavin Mak2025-06-172-21/+398
| | | | | | | | | | | | | | | | Introduce the parallel orchestration framework for `repo sync --interleaved`. The new logic respects project dependencies by processing them in hierarchical levels. Projects sharing a git object directory are grouped and processed serially. Also reuse the familiar fetch progress bar UX. Bug: 421935613 Change-Id: Ia388a231fa96b3220e343f952f07021bc9817d19 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/483281 Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* upload: fix FileNotFoundError when no superprojectGavin Mak2025-06-171-3/+6
| | | | | | | | | | | | | | Upload gets a FileNotFoundError if not using superproject because it tries to access the superproject's repo_id before checking if superproject was actually enabled. Reorder the logic to check use_superproject first. Change-Id: I65cd2adab481e799dd7bb75e1a83553ad6e34d8d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484401 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: Add scaffolding for interleaved syncGavin Mak2025-06-113-24/+95
| | | | | | | | | | | | | | Prepare for an interleaved fetch and checkout mode for `repo sync`. The goal of the new mode is to significantly speed up syncs by running fetch and checkout operations in parallel for different projects, rather than waiting for all fetches to complete before starting any checkouts. Bug: 421935613 Change-Id: I8c66d1e790c7bba6280e409b95238c5e4e61a9c8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/482821 Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* info: fix mismatched format args and wrong symbol namev2.55.2Scott Lee2025-06-101-1/+2
| | | | | | | | | | Bug: 416589884 Change-Id: Icbaade585932f0cbb51367e07925ef606f089697 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/482762 Commit-Queue: Scott Lee <ddoman@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Lint: Scott Lee <ddoman@google.com> Tested-by: Scott Lee <ddoman@google.com>
* hooks: add internal check for external hook APIMike Frysinger2025-06-061-0/+24
| | | | | | | | | | | | | Add an internal check to make sure we always follow the API we've documented for external authors. Since the internal call is a bit ad-hoc, it can be easy to miss a call site. Change-Id: Ie8cd298d1fc34f10f3c5eb353512a3e881f42252 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/481721 Reviewed-by: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* git_superproject: Replace walrus operatorv2.55.1Gavin Mak2025-06-041-2/+4
| | | | | | | | | | It was released in python 3.8, and repo still supports 3.6. Bug: 422226033 Change-Id: I6bdd2cdbb074766ecfb1492d842c847781c4b264 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/481201 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* upload: Add rev to rootRepo push optionv2.55Gavin Mak2025-05-281-1/+2
| | | | | | | | Bug: b/401147338 Change-Id: Iac19af5aadd250538702920d9beaeef9250c78fe Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478801 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* info: print superproject revisionScott Lee2025-05-272-1/+29
| | | | | | | | | | Bug: 416589884 Change-Id: I5d1c709518d76d777a7f07c4c774569773c5a265 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478205 Lint: Scott Lee <ddoman@google.com> Tested-by: Scott Lee <ddoman@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Scott Lee <ddoman@google.com>
* subcmds: delete redundant dest= settingsMike Frysinger2025-05-2718-52/+45
| | | | | | | | | | Add a test to enforce this too. Change-Id: I80b5cf567aa33db9c24b53428c66d69f9c1d8d74 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478481 Commit-Queue: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Scott Lee <ddoman@google.com>
* upload: Add superproject identifier as push optionGavin Mak2025-05-052-1/+26
| | | | | | | | | | | | When uploading, add the root superproject repo as a push option in the format `-o custom-keyed-value=rootRepo:$HOST/$PROJECT`. Bug: b/401147338 Change-Id: I00230256eb7ae307b03840bb4090c28dc8a0505e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/472601 Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* manifest: generalize --json as --format=<format>Mike Frysinger2025-04-303-8/+195
| | | | | | | | | | | | | | This will make it easier to add more formats without exploding the common --xxx space and checking a large set of boolean flags. Also fill out the test coverage while we're here. Bug: b/412725063 Change-Id: I754013dc6cb3445f8a0979cefec599d55dafdcff Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/471941 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* run_tests: only allow help2man skipping in CIMike Frysinger2025-04-301-1/+2
| | | | | | | | | | Make sure we run this for local devs. Change-Id: I472b7c347086d54649dd9d5778eea4737447b353 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/471921 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* update-manpages: include in unittestsMike Frysinger2025-04-282-4/+46
| | | | | | | | | | | | | People often forget to regen when making interface changes. We skip the test if help2man isn't installed since it's not common, and it's not available on our CI bots currently. Change-Id: Ib4911a0e3fa1294ad90e4ac8afc047a0b7c2b66d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/469741 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* flake8: Ignore .venv directoryErik Elmeke2025-04-231-0/+1
| | | | | | | | | | | | | .venv is by convention a very common place for venvs and is the default in some tools, for example like "Astral uv". The third-party packages installed there should not be linted. Change-Id: I3278d90c2fdfc8a34a2488e82d4df8e836111ce1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/469941 Tested-by: Erik Elmeke <erik@haleytek.corp-partner.google.com> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
* man: regenerate man pagesMike Frysinger2025-04-223-24/+10
| | | | | | | | Change-Id: Ie348f7a29523655bf1d6247af8302ff885420d75 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/469742 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* manifest: Remove redundant re-raise of BaseExceptionsErik Elmeke2025-04-221-6/+1
| | | | | | | | | | | | | | This change should be a noop from a functional point of view. Exceptions inheriting directly from BaseException (KeyboardInterrupt, SystemExit) are not caught by "except Exception", they will instead continue raising upwards the stack, so there is no need to explicitly catch and re-raise them. Change-Id: Ic10764af4a6c05d1162f8b21651e7864ed742286 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/469601 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Tested-by: Erik Elmeke <erik@haleytek.corp-partner.google.com>
* Fallback to full sync when depth enabled fetch of a sha1 failsKaushik Lingarkar2025-04-171-0/+8
| | | | | | | | | | | | | | | | In sha1 mode, when depth is enabled, syncing the revision from upstream may not work because some servers only allow fetching named refs. Fetching a specific sha1 may result in an error like 'server does not allow request for unadvertised object'. In this case, attempt a full sync with depth disabled. Bug: 410825502 Change-Id: If51bcf18b877cd9491706f5bc3d6fd13c0c3d4f3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/468282 Commit-Queue: Kaushik Lingarkar <kaushikl@qti.qualcomm.com> Tested-by: Kaushik Lingarkar <kaushikl@qti.qualcomm.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* project: use --netrc-optional instead of --netrcv2.54Gavin Mak2025-04-101-1/+8
| | | | | | | | | | | | | | | | | Some users are reporting a "curl: (26) .netrc error: no such file" message on sync caused by an change to curl behavior. See https://github.com/curl/curl/issues/16163. Use --netrc-optional which was introduced in curl version 7.9.8 released in 2002. Bug: 409354839 Change-Id: I8365c6e806968a4ee765a7e023b4bced30489c20 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/467026 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
* launcher: switch command quoting to shlex.quoteMike Frysinger2025-04-102-9/+10
| | | | | | | | | | | Minor fix, but just in case, provides properly quoted commands for people to copy & paste. Change-Id: Ia9fce5c0df9f51cbed9d49861adcf6821251e46f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/466821 Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* sync: Warn about excessive job countsGavin Mak2025-04-091-0/+20
| | | | | | | | | | | | | | | Warn users if the effective job count specified via `-j`, `--jobs-network`, or `--jobs-checkout` exceeds a threshold (currently 100). This encourages users to use more reasonable values. Bug: 406868778 Bug: 254914814 Change-Id: I116e2bbaf3dc824c04d1b2fbe52cf9ca5be77b9a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/466801 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* run_tests: fix running when cwd is not the rootMike Frysinger2025-04-031-5/+13
| | | | | | | | | | | | | | If you try running this from a subdir, then most of the tests fail because they assume they're running from the top of the source tree. Change all the tests to actually run there. For example: cd docs && ../run_tests Change-Id: I92e17476393a108e56b58e049193b9fd72c5b7ba Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/464841 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* run_tests: enable Python 3.8 CI coverageMike Frysinger2025-04-022-0/+90
| | | | | | | | Change-Id: I507da20d3b7234e9f2a22d7654a6405b362eebaf Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/464541 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* Fix EROFS error when root fs is mounted read-onlyEgor Duda2025-04-021-0/+6
| | | | | | | | | | | | | repo attempts to create /etc/.repo_gitconfig.json file, and fails if root file system is mounted read-only. Removing non-existing file on read-only filesystem results in EROFS instead of ENOENT. Bug: 401018409 Change-Id: I64edc0567fb88649f3fd8cacb65a8780744640d4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/458821 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Egor Duda <egor.duda@gmail.com> Commit-Queue: Egor Duda <egor.duda@gmail.com>
* pager: drop unused global varsMike Frysinger2025-04-011-1/+1
| | | | | | | | | | | We use global when we need to write to a variable, not read it. This function only reads, so drop the keyword. Change-Id: Iee91998fba67fd3e8ebaf2f4a79f95032f70b1c0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/464501 Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* launcher: change RunError to subprocess.CalledProcessErrorMike Frysinger2025-04-012-9/+6
| | | | | | | | | | | Since we require Python 3.6 now in the launcher, swap out our custom RunError class for the standard subprocess one. Change-Id: Id0ca17c40e22ece03e06366a263ad340963f979d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/464401 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Tested-by: Mike Frysinger <vapier@google.com>