# bug in t3700-add.sh?

3 messages from 2007-08-03 to 2007-08-03. Participants: Nguyen Thai Ngoc Duy, Junio C Hamano.
Thread: https://gitlist.dev/t/9371

## Nguyen Thai Ngoc Duy, 2007-08-03 20:51

Subject: bug in t3700-add.sh?
Message-ID: <fcaeb9bf0708031351g5e585a4bj849fbf2ec3720a18@mail.gmail.com>
URL: https://gitlist.dev/e/fcaeb9bf0708031351g5e585a4bj849fbf2ec3720a18%40mail.gmail.com

```
Hi,

Running test 17, I got this output:

* expecting success:
        git rm --cached -f file symlink &&
        (
                echo "100644 $(git hash-object -w stage1) 1     file"
                echo "100755 $(git hash-object -w stage2) 2     file"
                echo "100644 $(printf $s | git hash-object -w -t blob
--stdin) 1        symlink"
                echo "120000 $(printf $s | git hash-object -w -t blob
--stdin) 2        symlink"
        ) | git update-index --index-info &&
        git config core.filemode 0 &&
        git config core.symlinks 0 &&
        echo new > file &&
        echo new > symlink &&
        git add file symlink &&
        git ls-files --stage | grep "^100755 .* 0       file$" &&
        git ls-files --stage | grep "^120000 .* 0       symlink$"

rm 'file'
rm 'symlink'
printf: usage: printf [-v var] format [arguments]
printf: usage: printf [-v var] format [arguments]
100755 3e757656cf36eca53338e520d134963a44f793f8 0       file
120000 3e757656cf36eca53338e520d134963a44f793f8 0       symlink
*   ok 17: git add with filemode=0, symlinks=0 prefers stage 2 over stage 1

I don't know if "printf $s" was intentional because $s was empty and
caused printf to print out help usage. I have feeling that there is
something wrong here. Anyone can clarify?

Johannes Sixt CC'd as he added this code.
-- 
Duy

```

## Junio C Hamano, 2007-08-03 21:26

Subject: Re: bug in t3700-add.sh?
Message-ID: <7vabt8mhse.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vabt8mhse.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <fcaeb9bf0708031351g5e585a4bj849fbf2ec3720a18@mail.gmail.com>

```
"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> Running test 17, I got this output:

Gaah.  Those $s seem completely bogus.


diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index b52fde8..a27c593 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -131,8 +131,8 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
 	(
 		echo "100644 $(git hash-object -w stage1) 1	file"
 		echo "100755 $(git hash-object -w stage2) 2	file"
-		echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1	symlink"
-		echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2	symlink"
+		echo "100644 $(echo 1 | git hash-object -w -t blob --stdin) 1	symlink"
+		echo "120000 $(echo 2 | git hash-object -w -t blob --stdin) 2	symlink"
 	) | git update-index --index-info &&
 	git config core.filemode 0 &&
 	git config core.symlinks 0 &&

```

## Junio C Hamano, 2007-08-03 21:29

Subject: Re: bug in t3700-add.sh?
Message-ID: <7v643wmhmg.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v643wmhmg.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <fcaeb9bf0708031351g5e585a4bj849fbf2ec3720a18@mail.gmail.com>

```
"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> Running test 17, I got this output:

Gaah.  Those $s seem completely bogus.

This test only cares to see if the blob type is retained (it
does "git add" to the path later to throw away the unmergedness
and data at higher stage prepared by this step), so it really
does not matter what is fed to hash-object.  But it should be
hashing a file whose contents is '1' and a symlink to '2'.


diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index b52fde8..213e924 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -131,8 +131,8 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
 	(
 		echo "100644 $(git hash-object -w stage1) 1	file"
 		echo "100755 $(git hash-object -w stage2) 2	file"
-		echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1	symlink"
-		echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2	symlink"
+		echo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1	symlink"
+		echo "120000 $(printf 2 | git hash-object -w -t blob --stdin) 2	symlink"
 	) | git update-index --index-info &&
 	git config core.filemode 0 &&
 	git config core.symlinks 0 &&

```
