mailsplit: minor clean-up in read_line_with_nul()
[alt-git.git] / t / t5303-hash-object.sh
blob543c0784bdc09f4ab53a71b8d31f8935867600e7
1 #!/bin/sh
3 test_description=git-hash-object
5 . ./test-lib.sh
7 test_expect_success \
8 'git hash-object -w --stdin saves the object' \
9 'obname=$(echo foo | git hash-object -w --stdin) &&
10 obpath=$(echo $obname | sed -e "s/\(..\)/\1\//") &&
11 test -r .git/objects/"$obpath" &&
12 rm -f .git/objects/"$obpath"'
14 test_expect_success \
15 'git hash-object --stdin -w saves the object' \
16 'obname=$(echo foo | git hash-object --stdin -w) &&
17 obpath=$(echo $obname | sed -e "s/\(..\)/\1\//") &&
18 test -r .git/objects/"$obpath" &&
19 rm -f .git/objects/"$obpath"'
21 test_expect_success \
22 'git hash-object --stdin file1 <file0 first operates on file0, then file1' \
23 'echo foo > file1 &&
24 obname0=$(echo bar | git hash-object --stdin) &&
25 obname1=$(git hash-object file1) &&
26 obname0new=$(echo bar | git hash-object --stdin file1 | sed -n -e 1p) &&
27 obname1new=$(echo bar | git hash-object --stdin file1 | sed -n -e 2p) &&
28 test "$obname0" = "$obname0new" &&
29 test "$obname1" = "$obname1new"'
31 test_expect_success \
32 'git hash-object refuses multiple --stdin arguments' \
33 '! git hash-object --stdin --stdin < file1'
35 test_done