summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aadbe44)
raw | patch | inline | side by side (parent: aadbe44)
author | Jeff King <peff@peff.net> | |
Wed, 12 Mar 2008 21:34:34 +0000 (17:34 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 13 Mar 2008 07:57:52 +0000 (00:57 -0700) |
The "-n" syntax is not supported by System V versions of
tail (which prefer "tail -1"). Unfortunately "tail -1" is
not actually POSIX. We had some of both forms in our
scripts.
Since neither form works everywhere, this patch replaces
both with the equivalent sed invocation:
sed -ne '$p'
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tail (which prefer "tail -1"). Unfortunately "tail -1" is
not actually POSIX. We had some of both forms in our
scripts.
Since neither form works everywhere, this patch replaces
both with the equivalent sed invocation:
sed -ne '$p'
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/git-am.sh b/git-am.sh
index 1f6b5e02c5e7da45a8e7966b600946cff9c24832..ac5c388060789e559f80d61d6eae1db926b66ad4 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
LAST_SIGNED_OFF_BY=`
sed -ne '/^Signed-off-by: /p' \
"$dotest/msg-clean" |
- tail -n 1
+ sed -ne '$p'
`
ADD_SIGNOFF=`
test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
index 4c3280a76ebe94c21fd4078c57ab03b6399d16ae..8aa73712ca11f4527f4b8d42bf3a14de2a16c39c 100755 (executable)
make_squash_message () {
if test -f "$SQUASH_MSG"; then
COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
- < "$SQUASH_MSG" | tail -n 1)+1))
+ < "$SQUASH_MSG" | sed -ne '$p')+1))
echo "# This is a combination of $COUNT commits."
sed -e 1d -e '2,/^./{
/^$/d
index f09823106fa75f668291d94039746adac16b6880..9c0acc5a7e59bb1279d0f512ceed4b698d39474d 100755 (executable)
test_expect_success 'exchange two commits' '
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
- test H = $(git cat-file commit HEAD^ | tail -n 1) &&
- test G = $(git cat-file commit HEAD | tail -n 1)
+ test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
+ test G = $(git cat-file commit HEAD | sed -ne \$p)
'
cat > expect << EOF
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 67b9a7b84a6a411d44b6b5f90f7b33d6160b5702..b88b5bbd022bb3dd836d00f88a8e486c00285103 100755 (executable)
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
test_expect_success \
'[index v1] 2) create a stealth corruption in a delta base reference' \
'# this test assumes a delta smaller than 16 bytes at the end of the pack
- git show-index <1.idx | sort -n | tail -n 1 | (
+ git show-index <1.idx | sort -n | sed -ne \$p | (
read delta_offs delta_sha1 &&
git cat-file blob "$delta_sha1" > blob_1 &&
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
test_expect_success \
'[index v2] 2) create a stealth corruption in a delta base reference' \
'# this test assumes a delta smaller than 16 bytes at the end of the pack
- git show-index <1.idx | sort -n | tail -n 1 | (
+ git show-index <1.idx | sort -n | sed -ne \$p | (
read delta_offs delta_sha1 delta_crc &&
git cat-file blob "$delta_sha1" > blob_3 &&
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
index 4908e878fee48069fbdc339f17ad6e865111ae00..f471c1526f34fa87227ac23b458299063b408ff1 100755 (executable)
add_line_into_file "6: Yet a line." hello &&
HASH6=$(git rev-parse --verify HEAD) &&
echo "#"\!"/bin/sh" > test_script.sh &&
- echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
+ echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
echo "grep line hello > /dev/null" >> test_script.sh &&
echo "test \$? -ne 0" >> test_script.sh &&
chmod +x test_script.sh &&
add_line_into_file "7: Should be the last line." hello &&
HASH7=$(git rev-parse --verify HEAD) &&
echo "#"\!"/bin/sh" > test_script.sh &&
- echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
- echo "tail -1 hello | grep day > /dev/null && exit 125" >> test_script.sh &&
+ echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
+ echo "sed -ne \\\$p hello | grep day > /dev/null && exit 125" >> test_script.sh &&
echo "grep Yet hello > /dev/null" >> test_script.sh &&
echo "test \$? -ne 0" >> test_script.sh &&
chmod +x test_script.sh &&
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 590505bea61f9ca63c2eac2045e989ebc732c193..219411fd02f92a6af5f226912971ca43ae020003 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
fi &&
while test $# -gt 0
do
- head=$(head -n $i .git/MERGE_HEAD | tail -n 1)
+ head=$(head -n $i .git/MERGE_HEAD | sed -ne \$p)
if test "$1" != "$head"
then
echo "[OOPS] MERGE_HEAD $i != $1"
index e82b365fade5aaf48d58d80783bedc2e1be422b9..b91b151417758758bba9a7afb89ed54bd9b1dc7a 100755 (executable)
test_expect_success 'basic checkout' \
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/"
- test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | tail -n 1))" = "secondrootfile/1.1/"'
+ test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'
#------------------------
# PSERVER AUTHENTICATION
test_expect_success 'pserver authentication' \
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'pserver authentication failure (non-anonymous user)' \
'if cat request-git | git-cvsserver pserver >log 2>&1
else
true
fi &&
- tail -n1 log | grep "^I HATE YOU$"'
+ sed -ne \$p log | grep "^I HATE YOU$"'
test_expect_success 'pserver authentication (login)' \
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
'if cat login-git | git-cvsserver pserver >log 2>&1
else
true
fi &&
- tail -n1 log | grep "^I HATE YOU$"'
+ sed -ne \$p log | grep "^I HATE YOU$"'
# misuse pserver authentication for testing of req_Root
test_expect_success 'req_Root (strict paths)' \
'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (strict-paths)' '
! cat request-anonymous |
test_expect_success 'req_Root (w/o strict-paths)' \
'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (w/o strict-paths)' '
! cat request-anonymous |
test_expect_success 'req_Root (base-path)' \
'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (base-path)' '
! cat request-anonymous |
test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (export-all w/o whitelist)' \
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root (everything together)' \
'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep "^I LOVE YOU$"'
+ sed -ne \$p log | grep "^I LOVE YOU$"'
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1