Skip to content

Commit 4525e8e

Browse files
committed
Revert "mailinfo: Remove only one set of square brackets"
This reverts commit 650d30d. 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.
1 parent 05c1da2 commit 4525e8e

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

builtin-mailinfo.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ static void cleanup_subject(struct strbuf *subject)
221221
{
222222
char *pos;
223223
size_t remove;
224-
int brackets_removed = 0;
225-
226224
while (subject->len) {
227225
switch (*subject->buf) {
228226
case 'r': case 'R':
@@ -237,15 +235,10 @@ static void cleanup_subject(struct strbuf *subject)
237235
strbuf_remove(subject, 0, 1);
238236
continue;
239237
case '[':
240-
/* remove only one set of square brackets */
241-
if (brackets_removed)
242-
break;
243-
244238
if ((pos = strchr(subject->buf, ']'))) {
245239
remove = pos - subject->buf;
246240
if (remove <= (subject->len - remove) * 2) {
247241
strbuf_remove(subject, 0, remove + 1);
248-
brackets_removed = 1;
249242
continue;
250243
}
251244
} else

t/t5100/info0012

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Author: Dmitriy Blinov
22
3-
Subject: [Navy-patches] Изменён список пакетов необходимых для сборки
3+
Subject: Изменён список пакетов необходимых для сборки
44
Date: Wed, 12 Nov 2008 17:54:41 +0300
55

t/t5100/sample.mbox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ MIME-Version: 1.0
514514
Content-Type: text/plain;
515515
charset=utf-8
516516
Content-Transfer-Encoding: 8bit
517-
Subject: [PATCH] [Navy-patches]
517+
Subject: [Navy-patches] [PATCH]
518518
=?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
519519
=?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
520520
=?utf-8?b?0YHQsdC+0YDQutC4?=

0 commit comments

Comments
 (0)