# [PATCH] Remove bashism from t3210-pack-refs.sh

4 messages from 2006-10-06 to 2006-10-06. Participants: Dennis Stosberg, Alex Riesen, Jakub Narebski, Linus Torvalds.
Thread: https://gitlist.dev/t/5832

## Dennis Stosberg, 2006-10-06 09:10

Subject: [PATCH] Remove bashism from t3210-pack-refs.sh
Message-ID: <20061006091054.15209.35068.stgit@leonov.stosberg.net>
URL: https://gitlist.dev/e/20061006091054.15209.35068.stgit%40leonov.stosberg.net

```
This bashism makes the test fail if /bin/sh is not bash.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

 t/t3210-pack-refs.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index f31e79c..ca5bd49 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -23,7 +23,7 @@ SHA1=
 test_expect_success \
     'see if git show-ref works as expected' \
     'git-branch a &&
-     SHA1=$(< .git/refs/heads/a) &&
+     SHA1=`cat .git/refs/heads/a` &&
      echo "$SHA1 refs/heads/a" >expect &&
      git-show-ref a >result &&
      diff expect result'

```

## Alex Riesen, 2006-10-06 13:35

Subject: Re: [PATCH] Remove bashism from t3210-pack-refs.sh
Message-ID: <81b0412b0610060635n51482e71wab02f9a11be4e619@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0610060635n51482e71wab02f9a11be4e619%40mail.gmail.com
In-Reply-To: <20061006091054.15209.35068.stgit@leonov.stosberg.net>

```
On 10/6/06, Dennis Stosberg <dennis@stosberg.net> wrote:
> -     SHA1=$(< .git/refs/heads/a) &&
> +     SHA1=`cat .git/refs/heads/a` &&

Only "<" (the redirection part) is bashism. The "$()" is POSIX.

```

## Jakub Narebski, 2006-10-06 15:05

Subject: Re: [PATCH] Remove bashism from t3210-pack-refs.sh
Message-ID: <eg5r9k$58c$1@sea.gmane.org>
URL: https://gitlist.dev/e/eg5r9k%2458c%241%40sea.gmane.org
In-Reply-To: <81b0412b0610060635n51482e71wab02f9a11be4e619@mail.gmail.com>

```
Alex Riesen wrote:

> On 10/6/06, Dennis Stosberg <dennis@stosberg.net> wrote:
>> -     SHA1=$(< .git/refs/heads/a) &&
>> +     SHA1=`cat .git/refs/heads/a` &&
> 
> Only "<" (the redirection part) is bashism. The "$()" is POSIX.

BTW. it is not packed-refs safe.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Linus Torvalds, 2006-10-06 16:33

Subject: Re: [PATCH] Remove bashism from t3210-pack-refs.sh
Message-ID: <Pine.LNX.4.64.0610060931160.3952@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0610060931160.3952%40g5.osdl.org
In-Reply-To: <eg5r9k$58c$1@sea.gmane.org>

```


On Fri, 6 Oct 2006, Jakub Narebski wrote:
> Alex Riesen wrote:
> 
> > On 10/6/06, Dennis Stosberg <dennis@stosberg.net> wrote:
> >> -     SHA1=$(< .git/refs/heads/a) &&
> >> +     SHA1=`cat .git/refs/heads/a` &&
> > 
> > Only "<" (the redirection part) is bashism. The "$()" is POSIX.
> 
> BTW. it is not packed-refs safe.

Well, since that seems to be a test-case for the packed-refs thing, that's 
probably not a problem ;)

In a real-life git script you should do something like

	SHA1=$(git-rev-parse --verify "refs/heads/$head^0") && ...

to get the SHA1 and verify that it's all good, but since that script is 
all about checking that packing does the right thing, I think it's fine to 
do it by hand there..

		Linus

```
