fetch: align all "remote -> local" output

We do align "remote -> local" output by allocating 10 columns to
"remote". That produces aligned output only for short refs. An extra
pass is performed to find the longest remote ref name (that does not
produce a line longer than terminal width) to produce better aligned
output.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2016-07-01 18:03:30 +02:00
committed by Junio C Hamano
parent 2cb040baa6
commit 6bc91f23a6
2 changed files with 60 additions and 2 deletions

View File

@ -688,4 +688,19 @@ test_expect_success 'fetching with auto-gc does not lock up' '
)
'
test_expect_success 'fetch aligned output' '
git clone . full-output &&
test_commit looooooooooooong-tag &&
(
cd full-output &&
git fetch origin 2>&1 | \
grep -e "->" | cut -c 22- >../actual
) &&
cat >expect <<-\EOF &&
master -> origin/master
looooooooooooong-tag -> looooooooooooong-tag
EOF
test_cmp expect actual
'
test_done