git-submodule-integrate

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/git-submodule-integrate
Log | Files | Refs | README | LICENSE

commit 8ae7194e6c19a90890ad2aedcf104a497d39430c
parent 733d11721e1566c6b5a087975badc68fad40fdd9
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Sun, 12 Dec 2021 14:18:23 -0600

handle submodules properly and add explanatory comments

Diffstat:
Mgit-submodule-integrate | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/git-submodule-integrate b/git-submodule-integrate @@ -24,8 +24,15 @@ do # copy the files and subtrees into the parent git -C "$child" diff-tree -m --root -t "$commit" | while read line do + # don't need to copy object if it doesn't exist newhash=$(echo "$line" | cut -d' ' -f4) [ "$newhash" = "0000000000000000000000000000000000000000" ] && continue + + # don't need to copy object if it is a submodule + newmode=$(echo "$line" | cut -d' ' -f2) + [ "$newmode" = "160000" ] && continue + + # we already copied commits type=$(git -C "$child" cat-file -t "$newhash") [ "$type" = "commit" ] && continue