[PATCH] Write sed script directly into temp file, rather than a variable
When sed uses \n rather than ; as a separator (for BSD sed(1) compat), it is cleaner to use a file directly, rather than an environment variable containing \n characters. This change changes t/t6000 write to sed.script directly and changes the other tests to remove knowledge of sed.script. Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
f573571a21
commit
28346d2d3c
@ -1,6 +1,6 @@
|
|||||||
[ -d .git/refs/tags ] || mkdir -p .git/refs/tags
|
[ -d .git/refs/tags ] || mkdir -p .git/refs/tags
|
||||||
|
|
||||||
sed_script="";
|
:> sed.script
|
||||||
|
|
||||||
# Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags
|
# Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags
|
||||||
tag()
|
tag()
|
||||||
@ -21,7 +21,7 @@ unique_commit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Save the output of a command into the tag specified. Prepend
|
# Save the output of a command into the tag specified. Prepend
|
||||||
# a substitution script for the tag onto the front of $sed_script
|
# a substitution script for the tag onto the front of sed.script
|
||||||
save_tag()
|
save_tag()
|
||||||
{
|
{
|
||||||
_tag=$1
|
_tag=$1
|
||||||
@ -29,14 +29,16 @@ save_tag()
|
|||||||
shift 1
|
shift 1
|
||||||
"$@" >.git/refs/tags/$_tag
|
"$@" >.git/refs/tags/$_tag
|
||||||
|
|
||||||
sed_script="s/$(tag $_tag)/$_tag/g
|
echo "s/$(tag $_tag)/$_tag/g" > sed.script.tmp
|
||||||
$sed_script"
|
cat sed.script >> sed.script.tmp
|
||||||
|
rm sed.script
|
||||||
|
mv sed.script.tmp sed.script
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace unhelpful sha1 hashses with their symbolic equivalents
|
# Replace unhelpful sha1 hashses with their symbolic equivalents
|
||||||
entag()
|
entag()
|
||||||
{
|
{
|
||||||
sed "$sed_script"
|
sed -f sed.script
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
|
# Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
|
||||||
|
@ -103,15 +103,6 @@ save_tag g4 unique_commit g6 tree -p g3 -p h2
|
|||||||
|
|
||||||
tag l5 > .git/HEAD
|
tag l5 > .git/HEAD
|
||||||
|
|
||||||
#
|
|
||||||
# cd to t/trash and use
|
|
||||||
#
|
|
||||||
# git-rev-list ... 2>&1 | sed "$(cat sed.script)"
|
|
||||||
#
|
|
||||||
# if you ever want to manually debug the operation of git-rev-list
|
|
||||||
#
|
|
||||||
echo $sed_script > sed.script
|
|
||||||
|
|
||||||
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
|
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
|
||||||
19
|
19
|
||||||
EOF
|
EOF
|
||||||
|
@ -113,16 +113,6 @@ on_committer_date "1971-08-16 00:00:04" save_tag u4 unique_commit u4 tree -p u0
|
|||||||
on_committer_date "1971-08-16 00:00:05" save_tag u5 unique_commit u5 tree -p u0
|
on_committer_date "1971-08-16 00:00:05" save_tag u5 unique_commit u5 tree -p u0
|
||||||
on_committer_date "1971-08-16 00:00:06" save_tag V unique_commit V tree -p u1 -p u2 -p u3 -p u4 -p u5
|
on_committer_date "1971-08-16 00:00:06" save_tag V unique_commit V tree -p u1 -p u2 -p u3 -p u4 -p u5
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# cd to t/trash and use
|
|
||||||
#
|
|
||||||
# git-rev-list ... 2>&1 | sed "$(cat sed.script)"
|
|
||||||
#
|
|
||||||
# if you ever want to manually debug the operation of git-rev-list
|
|
||||||
#
|
|
||||||
echo $sed_script > sed.script
|
|
||||||
|
|
||||||
test_sequence()
|
test_sequence()
|
||||||
{
|
{
|
||||||
_bisect_option=$1
|
_bisect_option=$1
|
||||||
|
@ -79,15 +79,6 @@ save_tag g4 unique_commit g6 tree -p g3 -p h2
|
|||||||
|
|
||||||
tag l5 > .git/HEAD
|
tag l5 > .git/HEAD
|
||||||
|
|
||||||
#
|
|
||||||
# cd to t/trash and use
|
|
||||||
#
|
|
||||||
# git-rev-list ... 2>&1 | sed "$(cat sed.script)"
|
|
||||||
#
|
|
||||||
# if you ever want to manually debug the operation of git-rev-list
|
|
||||||
#
|
|
||||||
echo "$sed_script" | tr ' ' \\012 > sed.script
|
|
||||||
|
|
||||||
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
|
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
|
||||||
19
|
19
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user