From 4f1cfb994f3145f40e2cfa113756898a822d2364 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Wed, 26 Jun 2024 21:31:58 +0000 Subject: [PATCH] [scm] Add append to SetConfig Bug: b/348024314 Change-Id: Ib2066594806ffdf5f6941468e91a9ad7b8a02bef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5655832 Commit-Queue: Allen Li Reviewed-by: Yiwei Zhang --- scm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scm.py b/scm.py index 2809f0bac..c348abcca 100644 --- a/scm.py +++ b/scm.py @@ -188,6 +188,7 @@ class GIT(object): key, value=None, *, + append=False, missing_ok=True, modify_all=False, scope='local', @@ -199,6 +200,8 @@ class GIT(object): cwd: path to set `git config` for. key: The specific config key to affect. value: The value to set. If this is None, `key` will be unset. + append: If True and `value` is not None, this will append + the value instead of replacing an existing one. missing_ok: If `value` is None (i.e. this is an unset operation), ignore retcode=5 from `git config` (meaning that the value is not present). If `value` is not None, then this option has no @@ -222,7 +225,8 @@ class GIT(object): else: if modify_all: args.append('--replace-all') - + if append: + args.append('--add') args.extend([key, value]) if modify_all and value_pattern: