File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 249
249
if [ $VERBOSE -eq 1 ]; then
250
250
echo -n " archiving submodules..."
251
251
fi
252
+
253
+ TOP_TREEISH=$TREEISH
254
+ TOP_TREEISH_HASH=$( git rev-parse " $TOP_TREEISH " )
255
+ TOP_HEAD_HASH=$( git rev-parse HEAD)
252
256
git submodule status --recursive --cached >> " $TMPLIST "
253
257
while read path; do
254
- TREEISH=$( sed -nr -e ' s@^[ +-]@@' -e ' s@ +\(.*\)$@@' -e ' s@([^ ]+) +' " ${path%/ } " ' $@\1@ p' " $TMPLIST " ) # git submodule does not list trailing slashes in $path
258
+ # git submodule does not list trailing slashes in $path. Remove it in $TREEISH search.
259
+ TREEISH=$( git ls-tree " ${TOP_TREEISH} " " ${path%/ } " | awk ' { print $3 }' )
260
+ if [ -z " $TREEISH " ]; then
261
+ if [ " $TOP_TREEISH_HASH " != " $TOP_HEAD_HASH " ]; then
262
+ echo >&2 -e " \e[33;1mWarning:\e[22m Submodule \" ${path%/ } \" hash for top repo's ${TOP_TREEISH} was not obtained. Use the commit for top repo's HEAD.\e[m"
263
+ fi
264
+
265
+ TREEISH=$( sed -nr -e ' s@^[ +-]@@' -e ' s@ +\(.*\)$@@' -e ' s@([^ ]+) +' " ${path%/ } " ' $@\1@ p' " $TMPLIST " )
266
+ if [ -z " $TREEISH " ]; then
267
+ echo >&2 -e " \e[33;1mWarning:\e[22m Submodule \" ${path%/ } \" hash for top repo's HEAD was not obtained. Use the commit for the submodule's HEAD.\e[m"
268
+ TREEISH=HEAD
269
+ fi
270
+ fi
271
+ echo >&2 " Submodule \" ${path%/ } \" commit for top repo's ${TOP_TREEISH} : ${TREEISH:- HEAD} ($( git -C ${path} name-rev --name-only " ${TREEISH} " ) )"
272
+
255
273
cd " $path "
256
274
rm -f " $TMPDIR " /" $( echo " $path " | sed -e ' s/\//./g' ) " $FORMAT
257
275
git archive --format=$FORMAT --prefix=" ${PREFIX} $path " $ARCHIVE_OPTS ${TREEISH:- HEAD} > " $TMPDIR " /" $( echo " $path " | sed -e ' s/\//./g' ) " $FORMAT
You can’t perform that action at this time.
0 commit comments