Revert "mailinfo: Remove only one set of square brackets"
This reverts commit 650d30d8a120c8982309ccb9ef40432b4ea2eb74. Some mailing lists are configured add prefix "[listname] " to all their messages, and also people hand-edit subject lines, be it an output from format-patch or a patch generated by some other means. We cannot stop people from mucking with the subject line, and with the change, there always will be need for hand editing the subject when that happens. People have depended on the leading [bracketed string] removal.
Junio C Hamano committed
Jul 15, 2009 at 15:10 UTC
4525e8e41a8c0c4246a95097744604ea72198dad
3 files changed
+2
-9
builtin-mailinfo.c
-7
@@ -221,8 +221,6 @@ static void cleanup_subject(struct strbuf *subject)
221
{
222
char *pos;
223
size_t remove;
224
- int brackets_removed = 0;
225
-
224
while (subject->len) {
225
switch (*subject->buf) {
226
case 'r': case 'R':
@@ -237,15 +235,10 @@ static void cleanup_subject(struct strbuf *subject)
235
strbuf_remove(subject, 0, 1);
236
continue;
237
case '[':
240
- /* remove only one set of square brackets */
241
- if (brackets_removed)
242
- break;
243
-
238
if ((pos = strchr(subject->buf, ']'))) {
239
remove = pos - subject->buf;
240
if (remove <= (subject->len - remove) * 2) {
241
strbuf_remove(subject, 0, remove + 1);
248
- brackets_removed = 1;
242
continue;
243
}
244
} else
t/t5100/info0012
+1
-1
@@ -1,5 +1,5 @@
1
Author: Dmitriy Blinov
2
Email: bda@mnsspb.ru
3
-Subject: [Navy-patches] Изменён список пакетов необходимых для сборки
3
+Subject: Изменён список пакетов необходимых для сборки
4
Date: Wed, 12 Nov 2008 17:54:41 +0300
5
t/t5100/sample.mbox
+1
-1
@@ -514,7 +514,7 @@ MIME-Version: 1.0
514
Content-Type: text/plain;
515
charset=utf-8
516
Content-Transfer-Encoding: 8bit
517
-Subject: [PATCH] [Navy-patches]
517
+Subject: [Navy-patches] [PATCH]
518
=?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
519
=?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
520
=?utf-8?b?0YHQsdC+0YDQutC4?=