qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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>

authored by

Marc-André Lureau and committed by
Alex Bennée
84963b5b 4da6c0f9

+10 -8
+10 -8
scripts/archive-source.sh
··· 39 39 } 40 40 trap "cleanup" 0 1 2 3 15 41 41 42 - if git diff-index --quiet HEAD -- &>/dev/null 43 - then 44 - HEAD=HEAD 45 - else 46 - HEAD=$(git stash create) 47 - fi 42 + function tree_ish() { 43 + local retval='HEAD' 44 + if ! git diff-index --quiet --ignore-submodules=all HEAD -- &>/dev/null 45 + then 46 + retval=$(git stash create) 47 + fi 48 + echo "$retval" 49 + } 48 50 49 - git archive --format tar $HEAD > "$tar_file" 51 + git archive --format tar "$(tree_ish)" > "$tar_file" 50 52 test $? -ne 0 && error "failed to archive qemu" 51 53 for sm in $submodules; do 52 54 status="$(git submodule status "$sm")" ··· 62 64 echo "WARNING: submodule $sm is out of sync" 63 65 ;; 64 66 esac 65 - (cd $sm; git archive --format tar --prefix "$sm/" $smhash) > "$sub_file" 67 + (cd $sm; git archive --format tar --prefix "$sm/" $(tree_ish)) > "$sub_file" 66 68 test $? -ne 0 && error "failed to archive submodule $sm ($smhash)" 67 69 tar --concatenate --file "$tar_file" "$sub_file" 68 70 test $? -ne 0 && error "failed append submodule $sm to $tar_file"