]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(submodules/diff-name-only): Use `rev-parse`
authorOleg Broytman <phd@phdru.name>
Tue, 4 Oct 2022 21:16:59 +0000 (00:16 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 4 Oct 2022 21:21:00 +0000 (00:21 +0300)
Use `git rev-parse commit:submodule_path` instead of
`git ls-tree commit submodule_path | awk "{print $3}"`.

submodules/diff-name-only

index 445df523d2c1ce2d4ed5ca5276d05110cd38b982..90f481d4cf310d84457fee7107ec2ffd824e7744 100755 (executable)
@@ -26,7 +26,7 @@ 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}")`
+    prev_commit=`(git -C "$toplevel" rev-parse "$from_commit":"$sm_path")`
+    curr_commit=`(git -C "$toplevel" rev-parse "$to_commit":"$sm_path")`
     "$prog_dir/$prog_name" $prev_commit $curr_commit
 '