Skip to content

Commit

Permalink
Add REPO_SKIP_SELF_UPDATE check in sync
Browse files Browse the repository at this point in the history
The command _PostRepoFetch will try to self update
during repo sync. That is beneficial but adds
version uncertainty, fail potential and slow downs
in non-interactive scenarios.

Conditionally skip the update if env variable
REPO_SKIP_SELF_UPDATE is defined.

A call to selfupdate works as before, meaning even
with the variable set, it will run the update.

Change-Id: Iab0ef55dc3d3db3cbf1ba1f506c57fbb58a504c3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/439967
Tested-by: Fredrik de Groot <[email protected]>
Commit-Queue: Josip Sokcevic <[email protected]>
Reviewed-by: Josip Sokcevic <[email protected]>
  • Loading branch information
SpecificityD3luxe authored and LUCI committed Oct 28, 2024
1 parent 303bd96 commit ebdf040
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ If that tag is valid, then repo will warn and use that commit instead.

If that tag cannot be verified, it gives up and forces the user to resolve.

If env variable `REPO_SKIP_SELF_UPDATE` is defined, this will
bypass the self update algorithm.

### Force an update

The `repo selfupdate` command can be used to force an immediate update.
Expand Down
4 changes: 3 additions & 1 deletion subcmds/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,9 @@ def _FetchMain(
if not success:
err_event.set()

_PostRepoFetch(rp, opt.repo_verify)
# Call self update, unless requested not to
if os.environ.get("REPO_SKIP_SELF_UPDATE", "0") == "0":
_PostRepoFetch(rp, opt.repo_verify)
if opt.network_only:
# Bail out now; the rest touches the working tree.
if err_event.is_set():
Expand Down

0 comments on commit ebdf040

Please sign in to comment.