threads / patch / 5832

patchRemove bashism from t3210-pack-refs.sh

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

## tl;dr

4 messages between Oct 6, 2006 and Oct 6, 2006. Diffs are folded; open one to read it.

replies: 3people: 4as markdown or json

Dennis Stosberg· Oct 6, 2006, 09:10 UTC · lore
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(-)
Show changes to t/t3210-pack-refs.sh +1 −1
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· Oct 6, 2006, 13:35 UTC · re: Dennis Stosberg · lore

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

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· Oct 6, 2006, 15:05 UTC · re: Alex Riesen · lore

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

Alex Riesen wrote:
Show 5 quoted lines
> 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· Oct 6, 2006, 16:33 UTC · re: Jakub Narebski · lore

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

On Fri, 6 Oct 2006, Jakub Narebski wrote:
Show 9 quoted lines
> 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

← back to recent threads