tools/git-sync-deps: less verbose when fetch is needed
Change-Id: I0ab76132b9e21544ed3dfb87bd7adc91c4c4e656
Reviewed-on: https://skia-review.googlesource.com/8387
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tools/git-sync-deps b/tools/git-sync-deps
index 2b460cb..78449d9 100755
--- a/tools/git-sync-deps
+++ b/tools/git-sync-deps
@@ -142,12 +142,15 @@
sys.stdout.write('%s\n SYNC IS DISABLED.\n' % directory)
return
- if 0 == subprocess.call(
- [git, 'checkout', '--quiet', checkoutable], cwd=directory):
- # if this succeeds, skip slow `git fetch`.
- if verbose:
- status(directory, checkoutable) # Success.
- return
+ with open(os.devnull, 'w') as devnull:
+ # If this fails, we will fetch before trying again. Don't spam user
+ # with error infomation.
+ if 0 == subprocess.call([git, 'checkout', '--quiet', checkoutable],
+ cwd=directory, stderr=devnull):
+ # if this succeeds, skip slow `git fetch`.
+ if verbose:
+ status(directory, checkoutable) # Success.
+ return
# If the repo has changed, always force use of the correct repo.
# If origin already points to repo, this is a quick no-op.