Skip to content

Commit

Permalink
dist: Fix how submodules are found
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Jan 15, 2024
1 parent 19f76bb commit ee55475
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions git-archive-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,22 @@ superfile=`head -n 1 $TMPFILE`
if [ $VERBOSE -eq 1 ]; then
echo -n "looking for subprojects..."
fi
# find all '.git' dirs, these show us the remaining to-be-archived dirs
# we only want directories that are below the current directory
find . -mindepth 2 -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' >> $TOARCHIVE
# as of version 1.7.8, git places the submodule .git directories under the superprojects .git dir
# the submodules get a .git file that points to their .git dir. we need to find all of these too
find . -mindepth 2 -name '.git' -type f -print | xargs grep -l "gitdir" | sed -e 's/^\.\///' -e 's/\.git$//' >> $TOARCHIVE

# Find all submodules
# git submodule status --recursive can have the following output:
# ```
# sha1 module_path git_describe
# -sha1 module_path git_describe
# +sha1 module_path git_describe
# Usha1 module_path git_describe
# ```
# We remove the first space to standardize the output and we
# ignore special characters (user must manage it himself)
git submodule status --recursive | \
sed 's/^ //' | \
cut -d" " -f2 | \
xargs -I{} echo {}/ >> $TOARCHIVE

if [ $VERBOSE -eq 1 ]; then
echo "done"
echo " found:"
Expand Down

0 comments on commit ee55475

Please sign in to comment.