[PATCH] Make ls-* output consistent with diff-* output format.

Use SP as the column separator except the ones before path which
uses TAB, to make the output format consistent across ls-* and
diff-* commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Junio C Hamano 2005-05-26 14:38:19 -07:00 committed by Linus Torvalds
parent 6d3a5077dd
commit 2eab945e86
5 changed files with 94 additions and 94 deletions

View File

@ -262,7 +262,7 @@ static void show_files(void)
tag_cached, tag_cached,
ce->name, line_terminator); ce->name, line_terminator);
else else
printf("%s%06o %s %d %s%c", printf("%s%06o %s %d\t%s%c",
ce_stage(ce) ? tag_unmerged : ce_stage(ce) ? tag_unmerged :
tag_cached, tag_cached,
ntohl(ce->ce_mode), ntohl(ce->ce_mode),

View File

@ -127,7 +127,7 @@ static void list_recursive(void *buffer,
* print out the info * print out the info
*/ */
if (!matches || (matched != NULL && mtype == 0)) { if (!matches || (matched != NULL && mtype == 0)) {
printf("%06o\t%s\t%s\t", mode, printf("%06o %s %s\t", mode,
S_ISDIR(mode) ? "tree" : "blob", S_ISDIR(mode) ? "tree" : "blob",
sha1_to_hex(sha1)); sha1_to_hex(sha1));
print_path_prefix(&this_prefix); print_path_prefix(&this_prefix);

View File

@ -92,14 +92,14 @@ test_expect_success \
'git-ls-files --stage >current' 'git-ls-files --stage >current'
cat >expected <<\EOF cat >expected <<\EOF
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0 100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
120000 d8ce161addc5173867a3c3c730924388daedbc38 0 path2/file2sym 120000 d8ce161addc5173867a3c3c730924388daedbc38 0 path2/file2sym
100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0 path3/file3 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0 path3/file3
120000 8599103969b43aff7e430efea79ca4636466794f 0 path3/file3sym 120000 8599103969b43aff7e430efea79ca4636466794f 0 path3/file3sym
100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3
120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym
EOF EOF
test_expect_success \ test_expect_success \
'validate git-ls-files output for a known tree.' \ 'validate git-ls-files output for a known tree.' \
@ -116,10 +116,10 @@ test_expect_success \
'showing tree with git-ls-tree' \ 'showing tree with git-ls-tree' \
'git-ls-tree $tree >current' 'git-ls-tree $tree >current'
cat >expected <<\EOF cat >expected <<\EOF
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2 040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
EOF EOF
test_expect_success \ test_expect_success \
'git-ls-tree output for a known tree.' \ 'git-ls-tree output for a known tree.' \
@ -129,17 +129,17 @@ test_expect_success \
'showing tree with git-ls-tree -r' \ 'showing tree with git-ls-tree -r' \
'git-ls-tree -r $tree >current' 'git-ls-tree -r $tree >current'
cat >expected <<\EOF cat >expected <<\EOF
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2 040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2 100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym 120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3 100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym 120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2 path3/subp3 040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2 path3/subp3
100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3 100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
EOF EOF
test_expect_success \ test_expect_success \
'git-ls-tree -r output for a known tree.' \ 'git-ls-tree -r output for a known tree.' \

View File

@ -81,60 +81,60 @@ test_expect_success \
'3-way merge with git-read-tree -m' \ '3-way merge with git-read-tree -m' \
"git-read-tree -m $tree_O $tree_A $tree_B" "git-read-tree -m $tree_O $tree_A $tree_B"
strip_object_id='s/^\([0-7]*\) [0-9a-f]* \([0-3].*\)$/\1 \2/' _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
test_expect_success \ test_expect_success \
'git-ls-files --stage of the merge result' \ 'git-ls-files --stage of the merge result' \
'git-ls-files --stage >current- && 'git-ls-files --stage >current- &&
sed -e "$strip_object_id" <current- >current' sed -e "s/ $_x40 / X /" <current- >current'
cat >expected <<\EOF cat >expected <<\EOF
100644 2 AA 100644 X 2 AA
100644 3 AA 100644 X 3 AA
100644 2 AN 100644 X 2 AN
100644 1 DD 100644 X 1 DD
100644 3 DF 100644 X 3 DF
100644 2 DF/DF 100644 X 2 DF/DF
100644 1 DM 100644 X 1 DM
100644 3 DM 100644 X 3 DM
100644 1 DN 100644 X 1 DN
100644 3 DN 100644 X 3 DN
100644 2 LL 100644 X 2 LL
100644 3 LL 100644 X 3 LL
100644 1 MD 100644 X 1 MD
100644 2 MD 100644 X 2 MD
100644 1 MM 100644 X 1 MM
100644 2 MM 100644 X 2 MM
100644 3 MM 100644 X 3 MM
100644 0 MN 100644 X 0 MN
100644 3 NA 100644 X 3 NA
100644 1 ND 100644 X 1 ND
100644 2 ND 100644 X 2 ND
100644 0 NM 100644 X 0 NM
100644 0 NN 100644 X 0 NN
100644 0 SS 100644 X 0 SS
100644 1 TT 100644 X 1 TT
100644 2 TT 100644 X 2 TT
100644 3 TT 100644 X 3 TT
100644 2 Z/AA 100644 X 2 Z/AA
100644 3 Z/AA 100644 X 3 Z/AA
100644 2 Z/AN 100644 X 2 Z/AN
100644 1 Z/DD 100644 X 1 Z/DD
100644 1 Z/DM 100644 X 1 Z/DM
100644 3 Z/DM 100644 X 3 Z/DM
100644 1 Z/DN 100644 X 1 Z/DN
100644 3 Z/DN 100644 X 3 Z/DN
100644 1 Z/MD 100644 X 1 Z/MD
100644 2 Z/MD 100644 X 2 Z/MD
100644 1 Z/MM 100644 X 1 Z/MM
100644 2 Z/MM 100644 X 2 Z/MM
100644 3 Z/MM 100644 X 3 Z/MM
100644 0 Z/MN 100644 X 0 Z/MN
100644 3 Z/NA 100644 X 3 Z/NA
100644 1 Z/ND 100644 X 1 Z/ND
100644 2 Z/ND 100644 X 2 Z/ND
100644 0 Z/NM 100644 X 0 Z/NM
100644 0 Z/NN 100644 X 0 Z/NN
EOF EOF
test_expect_success \ test_expect_success \

View File

@ -34,7 +34,7 @@ test_expect_success \
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
test_output () { test_output () {
sed -e "s/ $_x40 / X /" <current >check sed -e "s/ $_x40 / X /" <current >check
diff -u expected check diff -u expected check
} }
@ -42,9 +42,9 @@ test_expect_success \
'ls-tree plain' \ 'ls-tree plain' \
'git-ls-tree $tree >current && 'git-ls-tree $tree >current &&
cat >expected <<\EOF && cat >expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
040000 tree X path2 040000 tree X path2
EOF EOF
test_output' test_output'
@ -52,13 +52,13 @@ test_expect_success \
'ls-tree recursive' \ 'ls-tree recursive' \
'git-ls-tree -r $tree >current && 'git-ls-tree -r $tree >current &&
cat >expected <<\EOF && cat >expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
040000 tree X path2 040000 tree X path2
040000 tree X path2/baz 040000 tree X path2/baz
100644 blob X path2/baz/b 100644 blob X path2/baz/b
120000 blob X path2/bazbo 120000 blob X path2/bazbo
100644 blob X path2/foo 100644 blob X path2/foo
EOF EOF
test_output' test_output'
@ -74,8 +74,8 @@ test_expect_success \
'ls-tree filtered' \ 'ls-tree filtered' \
'git-ls-tree $tree path1 path0 >current && 'git-ls-tree $tree path1 path0 >current &&
cat >expected <<\EOF && cat >expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
EOF EOF
test_output' test_output'
@ -83,11 +83,11 @@ test_expect_success \
'ls-tree filtered' \ 'ls-tree filtered' \
'git-ls-tree $tree path2 >current && 'git-ls-tree $tree path2 >current &&
cat >expected <<\EOF && cat >expected <<\EOF &&
040000 tree X path2 040000 tree X path2
040000 tree X path2/baz 040000 tree X path2/baz
100644 blob X path2/baz/b 100644 blob X path2/baz/b
120000 blob X path2/bazbo 120000 blob X path2/bazbo
100644 blob X path2/foo 100644 blob X path2/foo
EOF EOF
test_output' test_output'
@ -95,8 +95,8 @@ test_expect_success \
'ls-tree filtered' \ 'ls-tree filtered' \
'git-ls-tree $tree path2/baz >current && 'git-ls-tree $tree path2/baz >current &&
cat >expected <<\EOF && cat >expected <<\EOF &&
040000 tree X path2/baz 040000 tree X path2/baz
100644 blob X path2/baz/b 100644 blob X path2/baz/b
EOF EOF
test_output' test_output'