From: Oleg Broytman Date: Fri, 28 May 2021 09:28:05 +0000 (+0300) Subject: Refactor(submodules/diff-name-only): Remove excessive backslashes X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=05a269340e7584e2a963c07907ce706bdcb8ee53;p=git-scripts.git Refactor(submodules/diff-name-only): Remove excessive backslashes Use apostrophes for the internal script. Export variables from the external shell to be available in the internal script. --- diff --git a/submodules/diff-name-only b/submodules/diff-name-only index d513613..2209563 100755 --- a/submodules/diff-name-only +++ b/submodules/diff-name-only @@ -8,13 +8,14 @@ fi from_commit="$1" to_commit="${2:-HEAD}" +export from_commit to_commit # In the superproject git --no-pager diff --name-only "$from_commit" "$to_commit" -git submodule foreach " - # In submodule \"\$name\" - prev_commit=\`(git -C \"\$toplevel\" ls-tree "$from_commit" \"\$sm_path\" | awk '{print \$3}')\` - curr_commit=\`(git -C \"\$toplevel\" ls-tree "$to_commit" \"\$sm_path\" | awk '{print \$3}')\` - git --no-pager diff --name-only \$prev_commit \$curr_commit -" +git submodule foreach ' + # In submodule "$name" + prev_commit=`(git -C "$toplevel" ls-tree "$from_commit" "$sm_path" | awk "{print \\$3}")` + curr_commit=`(git -C "$toplevel" ls-tree "$to_commit" "$sm_path" | awk "{print \\$3}")` + git --no-pager diff --name-only $prev_commit $curr_commit +'