archive-source: also create a stash for submodules
"git archive" fails when a submodule has a modification, because "git stash create" doesn't handle submodules. Let's teach our archive-source.sh to handle modifications in submodules the same way as qemu tree, by creating a stash. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190708200250.12017-1-marcandre.lureau@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
4da6c0f9eb
commit
84963b5bbf
@ -39,14 +39,16 @@ function cleanup() {
|
|||||||
}
|
}
|
||||||
trap "cleanup" 0 1 2 3 15
|
trap "cleanup" 0 1 2 3 15
|
||||||
|
|
||||||
if git diff-index --quiet HEAD -- &>/dev/null
|
function tree_ish() {
|
||||||
|
local retval='HEAD'
|
||||||
|
if ! git diff-index --quiet --ignore-submodules=all HEAD -- &>/dev/null
|
||||||
then
|
then
|
||||||
HEAD=HEAD
|
retval=$(git stash create)
|
||||||
else
|
|
||||||
HEAD=$(git stash create)
|
|
||||||
fi
|
fi
|
||||||
|
echo "$retval"
|
||||||
|
}
|
||||||
|
|
||||||
git archive --format tar $HEAD > "$tar_file"
|
git archive --format tar "$(tree_ish)" > "$tar_file"
|
||||||
test $? -ne 0 && error "failed to archive qemu"
|
test $? -ne 0 && error "failed to archive qemu"
|
||||||
for sm in $submodules; do
|
for sm in $submodules; do
|
||||||
status="$(git submodule status "$sm")"
|
status="$(git submodule status "$sm")"
|
||||||
@ -62,7 +64,7 @@ for sm in $submodules; do
|
|||||||
echo "WARNING: submodule $sm is out of sync"
|
echo "WARNING: submodule $sm is out of sync"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
(cd $sm; git archive --format tar --prefix "$sm/" $smhash) > "$sub_file"
|
(cd $sm; git archive --format tar --prefix "$sm/" $(tree_ish)) > "$sub_file"
|
||||||
test $? -ne 0 && error "failed to archive submodule $sm ($smhash)"
|
test $? -ne 0 && error "failed to archive submodule $sm ($smhash)"
|
||||||
tar --concatenate --file "$tar_file" "$sub_file"
|
tar --concatenate --file "$tar_file" "$sub_file"
|
||||||
test $? -ne 0 && error "failed append submodule $sm to $tar_file"
|
test $? -ne 0 && error "failed append submodule $sm to $tar_file"
|
||||||
|
Loading…
Reference in New Issue
Block a user