1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-22 09:29:04 +02:00
git/t/t4006-diff-mode.sh
Elia Pinto e1d6b55d5d t4006-diff-mode.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-30 11:08:04 -07:00

60 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#
test_description='Test mode change diffs.
'
. ./test-lib.sh
sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'
test_expect_success 'setup' '
echo frotz >rezrov &&
git update-index --add rezrov &&
tree=$(git write-tree) &&
echo $tree
'
test_expect_success 'chmod' '
test_chmod +x rezrov &&
git diff-index $tree >current &&
sed -e "$sed_script" <current >check &&
echo ":100644 100755 X X M rezrov" >expected &&
test_cmp expected check
'
test_expect_success 'prepare binary file' '
git commit -m rezrov &&
printf "\00\01\02\03\04\05\06" >binbin &&
git add binbin &&
git commit -m binbin
'
# test_expect_success '--stat output after text chmod' '
# test_chmod -x rezrov &&
# echo " 0 files changed" >expect &&
# git diff HEAD --stat >actual &&
# test_i18ncmp expect actual
# '
#
# test_expect_success '--shortstat output after text chmod' '
# git diff HEAD --shortstat >actual &&
# test_i18ncmp expect actual
# '
#
# test_expect_success '--stat output after binary chmod' '
# test_chmod +x binbin &&
# echo " 0 files changed" >expect &&
# git diff HEAD --stat >actual &&
# test_i18ncmp expect actual
# '
#
# test_expect_success '--shortstat output after binary chmod' '
# git diff HEAD --shortstat >actual &&
# test_i18ncmp expect actual
# '
test_done