format-patch: support deep threading
For deep threading mode, i.e., the mode that gives a thread structured like + [PATCH 0/n] Cover letter `-+ [PATCH 1/n] First patch `-+ [PATCH 2/n] Second patch `-+ ... we currently have to use 'git send-email --thread' (the default). On the other hand, format-patch also has a --thread option which gives shallow mode, i.e., + [PATCH 0/n] Cover letter |-+ [PATCH 1/n] First patch |-+ [PATCH 2/n] Second patch ... To reduce the confusion resulting from having two indentically named features in different tools giving different results, let format-patch take an optional argument '--thread=deep' that gives the same output as 'send-mail --thread'. With no argument, or 'shallow', behave as before. Also add a configuration variable format.thread with the same semantics. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2175c10d5a
commit
30984ed2e9
@ -257,6 +257,126 @@ test_expect_success 'thread cover-letter in-reply-to' '
|
||||
--in-reply-to="<test.message>" --thread master
|
||||
'
|
||||
|
||||
test_expect_success 'thread explicit shallow' '
|
||||
check_threading expect.cl-irt --cover-letter \
|
||||
--in-reply-to="<test.message>" --thread=shallow master
|
||||
'
|
||||
|
||||
cat > expect.deep <<EOF
|
||||
---
|
||||
Message-Id: <0>
|
||||
---
|
||||
Message-Id: <1>
|
||||
In-Reply-To: <0>
|
||||
References: <0>
|
||||
---
|
||||
Message-Id: <2>
|
||||
In-Reply-To: <1>
|
||||
References: <0>
|
||||
<1>
|
||||
EOF
|
||||
|
||||
test_expect_success 'thread deep' '
|
||||
check_threading expect.deep --thread=deep master
|
||||
'
|
||||
|
||||
cat > expect.deep-irt <<EOF
|
||||
---
|
||||
Message-Id: <0>
|
||||
In-Reply-To: <1>
|
||||
References: <1>
|
||||
---
|
||||
Message-Id: <2>
|
||||
In-Reply-To: <0>
|
||||
References: <1>
|
||||
<0>
|
||||
---
|
||||
Message-Id: <3>
|
||||
In-Reply-To: <2>
|
||||
References: <1>
|
||||
<0>
|
||||
<2>
|
||||
EOF
|
||||
|
||||
test_expect_success 'thread deep in-reply-to' '
|
||||
check_threading expect.deep-irt --thread=deep \
|
||||
--in-reply-to="<test.message>" master
|
||||
'
|
||||
|
||||
cat > expect.deep-cl <<EOF
|
||||
---
|
||||
Message-Id: <0>
|
||||
---
|
||||
Message-Id: <1>
|
||||
In-Reply-To: <0>
|
||||
References: <0>
|
||||
---
|
||||
Message-Id: <2>
|
||||
In-Reply-To: <1>
|
||||
References: <0>
|
||||
<1>
|
||||
---
|
||||
Message-Id: <3>
|
||||
In-Reply-To: <2>
|
||||
References: <0>
|
||||
<1>
|
||||
<2>
|
||||
EOF
|
||||
|
||||
test_expect_success 'thread deep cover-letter' '
|
||||
check_threading expect.deep-cl --cover-letter --thread=deep master
|
||||
'
|
||||
|
||||
cat > expect.deep-cl-irt <<EOF
|
||||
---
|
||||
Message-Id: <0>
|
||||
In-Reply-To: <1>
|
||||
References: <1>
|
||||
---
|
||||
Message-Id: <2>
|
||||
In-Reply-To: <0>
|
||||
References: <1>
|
||||
<0>
|
||||
---
|
||||
Message-Id: <3>
|
||||
In-Reply-To: <2>
|
||||
References: <1>
|
||||
<0>
|
||||
<2>
|
||||
---
|
||||
Message-Id: <4>
|
||||
In-Reply-To: <3>
|
||||
References: <1>
|
||||
<0>
|
||||
<2>
|
||||
<3>
|
||||
EOF
|
||||
|
||||
test_expect_success 'thread deep cover-letter in-reply-to' '
|
||||
check_threading expect.deep-cl-irt --cover-letter \
|
||||
--in-reply-to="<test.message>" --thread=deep master
|
||||
'
|
||||
|
||||
test_expect_success 'thread via config' '
|
||||
git config format.thread true &&
|
||||
check_threading expect.thread master
|
||||
'
|
||||
|
||||
test_expect_success 'thread deep via config' '
|
||||
git config format.thread deep &&
|
||||
check_threading expect.deep master
|
||||
'
|
||||
|
||||
test_expect_success 'thread config + override' '
|
||||
git config format.thread deep &&
|
||||
check_threading expect.thread --thread master
|
||||
'
|
||||
|
||||
test_expect_success 'thread config + --no-thread' '
|
||||
git config format.thread deep &&
|
||||
check_threading expect.no-threading --no-thread master
|
||||
'
|
||||
|
||||
test_expect_success 'excessive subject' '
|
||||
|
||||
rm -rf patches/ &&
|
||||
|
Reference in New Issue
Block a user