From bc437d10202c015a5733f706dc44fa6bbf4d85b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 1 Jul 2016 18:03:31 +0200 Subject: fetch: reduce duplicate in ref update status lines with placeholder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the "remote -> local" line, if either ref is a substring of the other, the common part in the other string is replaced with "*". For example abc -> origin/abc refs/pull/123/head -> pull/123 become abc -> origin/* refs/*/head -> pull/123 Activated with fetch.output=compact. For the record, this output is not perfect. A single giant ref can push all refs very far to the right and likely be wrapped around. We may have a few options: - exclude these long lines smarter - break the line after "->", exclude it from column width calculation - implement a new format, { -> origin/}foo, which makes the problem go away at the cost of a bit harder to read - reverse all the arrows so we have "* <- looong-ref", again still hard to read. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index f50497eaa1..603277655b 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -693,7 +693,7 @@ test_expect_success 'fetch aligned output' ' test_commit looooooooooooong-tag && ( cd full-output && - git fetch origin 2>&1 | \ + git -c fetch.output=full fetch origin 2>&1 | \ grep -e "->" | cut -c 22- >../actual ) && cat >expect <<-\EOF && @@ -703,4 +703,19 @@ test_expect_success 'fetch aligned output' ' test_cmp expect actual ' +test_expect_success 'fetch compact output' ' + git clone . compact && + test_commit extraaa && + ( + cd compact && + git -c fetch.output=compact fetch origin 2>&1 | \ + grep -e "->" | cut -c 22- >../actual + ) && + cat >expect <<-\EOF && + master -> origin/* + extraaa -> * + EOF + test_cmp expect actual +' + test_done -- cgit v1.2.1