Merge branch 'ae/maint-mailinfo-rm-only-one-patch-marker'
authorJunio C Hamano <gitster@pobox.com>
Sat, 11 Jul 2009 03:18:09 +0000 (20:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Jul 2009 03:18:09 +0000 (20:18 -0700)
* ae/maint-mailinfo-rm-only-one-patch-marker:
mailinfo: Remove only one set of square brackets

1  2 
builtin-mailinfo.c
t/t5100/sample.mbox
diff --combined builtin-mailinfo.c
index 92637ac0bae82d0b88e267b572a51a75299cda5c,be42532d437620333f7ddeb5d1825383435800ce..fb5ad70f3fddeb560fbd045e1112a0bc739b6c9e
@@@ -193,7 -193,8 +193,7 @@@ static void handle_content_type(struct 
                *content_top = boundary;
                boundary = NULL;
        }
 -      if (slurp_attr(line->buf, "charset=", &charset))
 -              strbuf_tolower(&charset);
 +      slurp_attr(line->buf, "charset=", &charset);
  
        if (boundary) {
                strbuf_release(boundary);
@@@ -221,6 -222,8 +221,8 @@@ static void cleanup_subject(struct strb
  {
        char *pos;
        size_t remove;
+       int brackets_removed = 0;
        while (subject->len) {
                switch (*subject->buf) {
                case 'r': case 'R':
                        strbuf_remove(subject, 0, 1);
                        continue;
                case '[':
+                       /* remove only one set of square brackets */
+                       if (brackets_removed)
+                               break;
                        if ((pos = strchr(subject->buf, ']'))) {
                                remove = pos - subject->buf;
                                if (remove <= (subject->len - remove) * 2) {
                                        strbuf_remove(subject, 0, remove + 1);
+                                       brackets_removed = 1;
                                        continue;
                                }
                        } else
@@@ -480,7 -488,7 +487,7 @@@ static const char *guess_charset(const 
                if (is_utf8(line->buf))
                        return NULL;
        }
 -      return "latin1";
 +      return "ISO8859-1";
  }
  
  static void convert_to_utf8(struct strbuf *line, const char *charset)
                        return;
        }
  
 -      if (!strcmp(metainfo_charset, charset))
 +      if (!strcasecmp(metainfo_charset, charset))
                return;
        out = reencode_string(line->buf, metainfo_charset, charset);
        if (!out)
@@@ -549,6 -557,7 +556,6 @@@ static int decode_header_bq(struct strb
                if (cp + 3 - it->buf > it->len)
                        goto decode_header_bq_out;
                strbuf_add(&charset_q, ep, cp - ep);
 -              strbuf_tolower(&charset_q);
  
                encoding = cp[1];
                if (!encoding || cp[2] != '?')
@@@ -942,7 -951,7 +949,7 @@@ int cmd_mailinfo(int argc, const char *
         */
        git_config(git_default_config, NULL);
  
 -      def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8");
 +      def_charset = (git_commit_encoding ? git_commit_encoding : "UTF-8");
        metainfo_charset = def_charset;
  
        while (1 < argc && argv[1][0] == '-') {
diff --combined t/t5100/sample.mbox
index c3074ac5736fe266e901b4da3b060208cd71406e,ba4d0c9baf21753aa95447e49f7a0f3843058d0e..3a757d7d8f9df23d6a217ac86a581f27c6479240
@@@ -99,7 -99,7 +99,7 @@@ index 9123cdc..918dcf8 10064
  From nobody Sat Aug 27 23:07:49 2005
  Path: news.gmane.org!not-for-mail
  Message-ID: <20050721.091036.01119516.yoshfuji@linux-ipv6.org>
 -From: YOSHIFUJI Hideaki / =?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?= 
 +From: YOSHIFUJI Hideaki / =?ISO-2022-JP?B?GyRCNUhGIzFRTEAbKEI=?= 
        <yoshfuji@linux-ipv6.org>
  Newsgroups: gmane.comp.version-control.git
  Subject: [PATCH 1/2] GIT: Try all addresses for given remote name
@@@ -218,7 -218,7 +218,7 @@@ GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D
  From nobody Sat Aug 27 23:07:49 2005
  Path: news.gmane.org!not-for-mail
  Message-ID: <u5tacjjdpxq.fsf@lysator.liu.se>
 -From: =?iso-8859-1?Q?David_K=E5gedal?= <davidk@lysator.liu.se>
 +From: =?ISO8859-1?Q?David_K=E5gedal?= <davidk@lysator.liu.se>
  Newsgroups: gmane.comp.version-control.git
  Subject: [PATCH] Fixed two bugs in git-cvsimport-script.
  Date: Mon, 15 Aug 2005 20:18:25 +0200
@@@ -226,7 -226,7 +226,7 @@@ Lines: 8
  Approved: news@gmane.org
  NNTP-Posting-Host: main.gmane.org
  Mime-Version: 1.0
 -Content-Type: text/plain; charset=iso-8859-1
 +Content-Type: text/plain; charset=ISO8859-1
  Content-Transfer-Encoding: QUOTED-PRINTABLE
  X-Trace: sea.gmane.org 1124130247 31839 80.91.229.2 (15 Aug 2005 18:24:07 GMT)
  X-Complaints-To: usenet@sea.gmane.org
@@@ -476,7 -476,7 +476,7 @@@ MIME-Version: 1.
  Content-Type: multipart/mixed; boundary="=-=-="
  
  --=-=-=
 -Content-Type: text/plain; charset=iso-8859-15
 +Content-Type: text/plain; charset=ISO8859-15
  Content-Transfer-Encoding: quoted-printable
  
  Here comes a commit log message, and
@@@ -514,7 -514,7 +514,7 @@@ MIME-Version: 1.
  Content-Type: text/plain;
    charset=utf-8
  Content-Transfer-Encoding: 8bit
- Subject: [Navy-patches] [PATCH]
+ Subject: [PATCH] [Navy-patches]
        =?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
        =?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
        =?utf-8?b?0YHQsdC+0YDQutC4?=