diff --git a/git_cl.py b/git_cl.py index a85226f86f..30088cca3a 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2540,11 +2540,12 @@ class Changelist(object): options.add_owners_to, change) reviewers = sorted(change_desc.get_reviewers()) - # Add cc's from the CC_LIST and --cc flag (if any). - if not options.private and not options.no_autocc: + cc = [] + # Add CCs from WATCHLISTS and rietveld.cc git config unless this is + # the initial upload, the CL is private, or auto-CCing has ben disabled. + if not (self.GetIssue() or options.private or options.no_autocc): cc = self.GetCCList().split(',') - else: - cc = [] + # Add cc's from the --cc flag. if options.cc: cc.extend(options.cc) cc = filter(None, [email.strip() for email in cc]) diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 9881bd29ce..d3b083eeec 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -1062,16 +1062,18 @@ class TestGitCl(TestCase): ref_suffix += ',m=' + title metrics_arguments.append('m') - calls += [ - ((['git', 'config', 'rietveld.cc'],), ''), - ] + if issue is None: + calls += [ + ((['git', 'config', 'rietveld.cc'],), ''), + ] if short_hostname == 'chromium': # All reviwers and ccs get into ref_suffix. for r in sorted(reviewers): ref_suffix += ',r=%s' % r metrics_arguments.append('r') - for c in sorted(['chromium-reviews+test-more-cc@chromium.org', - 'joe@example.com'] + cc): + if issue is None: + cc += ['chromium-reviews+test-more-cc@chromium.org', 'joe@example.com'] + for c in sorted(cc): ref_suffix += ',cc=%s' % c metrics_arguments.append('cc') reviewers, cc = [], [] @@ -1091,7 +1093,9 @@ class TestGitCl(TestCase): ref_suffix += ',r=%s' % r metrics_arguments.append('r') reviewers.remove(r) - for c in sorted(['joe@example.com'] + cc): + if issue is None: + cc += ['joe@example.com'] + for c in sorted(cc): ref_suffix += ',cc=%s' % c metrics_arguments.append('cc') if c in cc: