Subject: Re: [PATCH v2 001/142] check-builtins.sh: use the $( ... ) construct for command substitution

From: Matthieu Moy <[email-masked]>
Date: Wed, 26 Mar 2014 07:57:37 +0100

Elia Pinto <[email-masked]> writes:

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

What does this do in the case there are multiple ` on the same line?
(nested backquotes or multiple `...` `...` on the same line)

There are not many instances, and it seems no nested backquotes in Git's
source code:

$ git grep '`.*`.*`' -- '*.sh'
t/t5506-remote-groups.sh:       if test "`git log -1 --pretty=format:%s $1 --`" = "`cat mark`"; then
t/t9300-fast-import.sh:  test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
t/t9300-fast-import.sh:  test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
t/t9300-fast-import.sh:  test `git rev-parse N3` = `git rev-parse O1`'
t/t9300-fast-import.sh:  test `git rev-parse N3` = `git rev-parse O2`'
t/t9300-fast-import.sh:  test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&

The instance in t5506-remote-groups.sh is correct (probably fixed by
hand, which would deserve to be in the commit message).

I did not receive the patch about t9300-fast-import.sh (the serie seems
to have stopped at PATCH 105/144).

The other problematic case I can think of is `...` in comments. It seems
I caught the problematic ones in t/t0204-gettext-reencode-sanity.sh and
t/t6111-rev-list-treesame.sh, and git-pull.sh was correct already.

$ git grep '#.*`.*`' -- '*.sh'
git-pull.sh:# Setup default fast-forward options via `pull.ff`
t/t0204-gettext-reencode-sanity.sh:#   FreeBSD: `einfaldar` og "tvöfaldar"  [GNU libintl]
t/t4057-diff-combined-paths.sh:# `git diff -c --name-only HEAD HEAD^ HEAD^2`
t/t5522-pull-symlink.sh:# "cd `git rev-parse --show-cdup`", it ended up in the wrong
t/t6111-rev-list-treesame.sh:#    `-C-'          `-*I-*J
t/test-lib-functions.sh:#       for i in `test_seq 100`; do
t/test-lib-functions.sh:#               for j in `test_seq 10 20`; do
t/test-lib-functions.sh:#                       for k in `test_seq a z`; do

Again, something to mention in commit messages I think.

The first review I did was completely manual, but I would not call it a
thorough one.

It's probably a better idea to publish your branch somewhere than to
continue sending batches of 140 emails to the list for this kind of
topics.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/