diff options
author | Josip Sokcevic <sokcevic@chromium.org> | 2024-09-26 21:55:10 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-09-26 22:10:36 +0000 |
commit | 621de7ed127f2adb39ed1f0747383ac2afc4d075 (patch) | |
tree | d5bdd5a66932a3aa93193d01291e5ae580c3a873 /project.py | |
parent | d7ebdf56be6095338ea37bd4b52533c5bd7774e7 (diff) | |
download | git-repo-621de7ed127f2adb39ed1f0747383ac2afc4d075.tar.gz |
Disable git terminal prompt during fetch/clone
git fetch operation may prompt user to enter username and password.
This won't be visible to user when repo sync operation since stdout and
stderr are redirected. If that happens, user may think repo is doing
work and likely won't realize it's stuck on user's input.
This patch disables prompt for clone and fetch operations, and repo will
fail fast.
R=gavinmak@google.com
Bug: b/368644181
Change-Id: I2efa88ae66067587a00678eda155d861034b9127
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/438001
Reviewed-by: Nasser Grainawi <nasser.grainawi@linaro.org>
Tested-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2697,6 +2697,19 @@ class Project: | |||
2697 | ) | 2697 | ) |
2698 | # Continue right away so we don't sleep as we shouldn't need to. | 2698 | # Continue right away so we don't sleep as we shouldn't need to. |
2699 | continue | 2699 | continue |
2700 | elif ( | ||
2701 | ret == 128 | ||
2702 | and gitcmd.stdout | ||
2703 | and "fatal: could not read Username" in gitcmd.stdout | ||
2704 | ): | ||
2705 | # User needs to be authenticated, and Git wants to prompt for | ||
2706 | # username and password. | ||
2707 | print( | ||
2708 | "git requires authentication, but repo cannot perform " | ||
2709 | "interactive authentication. Check git credentials.", | ||
2710 | file=output_redir, | ||
2711 | ) | ||
2712 | break | ||
2700 | elif current_branch_only and is_sha1 and ret == 128: | 2713 | elif current_branch_only and is_sha1 and ret == 128: |
2701 | # Exit code 128 means "couldn't find the ref you asked for"; if | 2714 | # Exit code 128 means "couldn't find the ref you asked for"; if |
2702 | # we're in sha1 mode, we just tried sync'ing from the upstream | 2715 | # we're in sha1 mode, we just tried sync'ing from the upstream |