Gerrit git cl: allow overriding GERRIT_SQUASH_UPLOADS in git config.
Previously, if GERRIT_SQUASH_UPLOADS was found in codereview.settings,
a local repository value of gerrit.squash-uploads would be set.
This CL changes that, so that gerrit.squash-uploads property is written
with GERRIT_SQUASH_UPLOADS value ONLY IF the property wasn't set before.
This allows individual users to choose their own way with
git config [--global] -bool gerrit.squash-uploads (true|false)
BUG=611892
R=andybons@chromium.org,sergiyb@chromium.org
Review-Url: https://codereview.chromium.org/2070013002
diff --git a/git_cl.py b/git_cl.py
index b01b7db..767c5a8 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2835,8 +2835,10 @@
RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']])
if 'GERRIT_SQUASH_UPLOADS' in keyvals:
- RunGit(['config', 'gerrit.squash-uploads',
- keyvals['GERRIT_SQUASH_UPLOADS']])
+ cur = RunGit(['config', '--bool', 'gerrit.squash-uploads'], error_ok=True)
+ if not cur: # Set the value only if it wasn't set by the user manually.
+ RunGit(['config', 'gerrit.squash-uploads',
+ keyvals['GERRIT_SQUASH_UPLOADS']])
if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals:
RunGit(['config', 'gerrit.skip-ensure-authenticated',