Skip to content

Commit

Permalink
Merge branch 'mt/openindiana-portability' into next
Browse files Browse the repository at this point in the history
Portability updates to various uses of grep and sed.

* mt/openindiana-portability:
  t/t9001-send-email.sh: sed - remove the i flag for s
  t/t9118-git-svn-funky-branch-names.sh: sed needs semicolon
  t/t1700-split-index.sh: mv -v is not portable
  t/t4202-log.sh: fix misspelled variable
  t/t0600-reffiles-backend.sh: rm -v is not portable
  t/t9902-completion.sh: backslashes in echo
  Switch grep from non-portable BRE to portable ERE
  • Loading branch information
gitster committed May 17, 2024
2 parents c8f8136 + bac28a9 commit de53f37
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mergetools/vimdiff
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ gen_cmd () {
fi

# If this is a single window diff with all the buffers
if ! echo "$tab" | grep ",\|/" >/dev/null
if ! echo "$tab" | grep -E ",|/" >/dev/null
then
CMD="$CMD | silent execute 'bufdo diffthis'"
fi
Expand Down
2 changes: 1 addition & 1 deletion t/t0600-reffiles-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' '
test_when_finished "rm -rf subdir" &&
git init --bare subdir &&
rm -rfv subdir/refs subdir/objects subdir/packed-refs &&
rm -rf subdir/refs subdir/objects subdir/packed-refs &&
ln -s ../.git/refs subdir/refs &&
ln -s ../.git/objects subdir/objects &&
ln -s ../.git/packed-refs subdir/packed-refs &&
Expand Down
2 changes: 1 addition & 1 deletion t/t1404-update-ref-errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ df_test() {
printf "%s\n" "delete $delname" "create $addname $D"
fi >commands &&
test_must_fail git update-ref --stdin <commands 2>output.err &&
grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err &&
grep -E "fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err &&
printf "%s\n" "$C $delref" >expected-refs &&
git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
test_cmp expected-refs actual-refs
Expand Down
2 changes: 1 addition & 1 deletion t/t1700-split-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ test_expect_success 'reading split index at alternate location' '
# ... and, for backwards compatibility, in the current GIT_DIR
# as well.
mv -v ./reading-alternate-location/.git/sharedindex.* .git &&
mv ./reading-alternate-location/.git/sharedindex.* .git &&
GIT_INDEX_FILE=./reading-alternate-location/.git/index \
git ls-files --cached >actual &&
test_cmp expect actual
Expand Down
2 changes: 1 addition & 1 deletion t/t4202-log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ test_expect_success GPGSM 'log --graph --show-signature x509' '
test_expect_success GPGSSH 'log --graph --show-signature ssh' '
test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
git log --graph --show-signature -n1 signed-ssh >actual &&
grep "${GOOD_SIGNATURE_TRUSTED}" actual
grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
'

test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on expired signature key' '
Expand Down
2 changes: 1 addition & 1 deletion t/t9001-send-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' '

test_expect_success $PREREQ '--compose handles lowercase headers' '
write_script fake-editor <<-\EOF &&
sed "s/^From:.*/from: edited-from@example.com/i" "$1" >"$1.tmp" &&
sed "s/^[Ff][Rr][Oo][Mm]:.*/from: edited-from@example.com/" "$1" >"$1.tmp" &&
mv "$1.tmp" "$1"
EOF
clean_fake_sendmail &&
Expand Down
2 changes: 1 addition & 1 deletion t/t9118-git-svn-funky-branch-names.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test_expect_success 'setup svnrepo' '
# SVN 1.7 will truncate "not-a%40{0]" to just "not-a".
# Look at what SVN wound up naming the branch and use that.
# Be sure to escape the @ if it shows up.
non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | sed -ne '/not-a/ { s/\///; s/@/%40/; p }')
non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | sed -ne '/not-a/ { s/\///; s/@/%40/; p; }')

test_expect_success 'test clone with funky branch names' '
git svn clone -s "$svnrepo/pr ject" project &&
Expand Down
2 changes: 1 addition & 1 deletion t/t9902-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _get_comp_words_by_ref ()
print_comp ()
{
local IFS=$'\n'
echo "${COMPREPLY[*]}" > out
printf '%s\n' "${COMPREPLY[*]}" > out
}

run_completion ()
Expand Down

0 comments on commit de53f37

Please sign in to comment.