{"thread":{"id":"21607","subject":"[StGIT PATCH] allow --cc=myself to work again","startedAt":"2009-11-13T19:27:42Z","lastAt":"2009-11-13T19:27:42Z","messageCount":1,"participants":["Alex Chiang"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"127514","messageId":"20091113192742.GC1800@ldl.fc.hp.com","threadId":"21607","inReplyTo":null,"subject":"[StGIT PATCH] allow --cc=myself to work again","fromName":"Alex Chiang","fromEmail":"achiang@hp.com","sentAt":"2009-11-13T19:27:42Z","receivedAt":"2009-11-13T19:27:42Z","isPatch":true,"sender":{"key":"achiang@hp.com","avatar":null},"body":"commit cd74a041 filtered duplicate email addresses, especially\nwith the --auto option.\n\nHowever, it broke a common practice of cc'ing yourself on a\npatch. [nb, I don't do this myself, but there are several legit\nreasons]\n\nThis patch allows you to do something like:\n\n\tstg mail --to=<someaddr> --cc=<myaddr> --auto <patch>\n\nUnder my testing, with <myaddr> in the Signed-off-by: path:\n\n\t- we still do not send duplicates to <myaddr> (cd74a041 still holds)\n\t- we do not Cc: <myaddr> unless explicitly specified with --cc=\n\nI believe this is the behaviour that closest matches what a user\nactually wants without sending multiple, annoying Cc:'s.\n\nSigned-off-by: Alex Chiang <achiang@hp.com>\n---\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex abd42e4..4b0ac7b 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -272,9 +272,8 @@ def __build_address_headers(msg, options, extra_cc = []):\n     cc_set = __update_header('Cc', cc_addr, to_set)\n     bcc_set = __update_header('Bcc', bcc_addr, to_set.union(cc_set))\n \n-    # --auto generated addresses, don't include the sender\n-    from_set = __update_header('From')\n-    __update_header('Cc', extra_cc_addr, to_set.union(bcc_set).union(from_set))\n+    # --auto generated addresses\n+    __update_header('Cc', extra_cc_addr, to_set.union(bcc_set))\n \n     # update other address headers\n     __update_header('Reply-To')\n@@ -528,8 +527,11 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):\n     except Exception, ex:\n         raise CmdException, 'template parsing error: %s' % str(ex)\n \n+    # Get signers, but filter sender from list. Results in:\n+    # do not auto-cc the sender unless explicitly specified with --cc=\n     if options.auto:\n         extra_cc = __get_signers_list(descr)\n+        extra_cc = list(set.symmetric_difference(set([sender]), set(extra_cc)))\n     else:\n         extra_cc = []\n \n"}]}