qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>,
	thuth@redhat.com, alex.bennee@linaro.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] archive-source: also create a stash for submodules
Date: Sat, 13 Jul 2019 17:49:06 +0200	[thread overview]
Message-ID: <0b0c6aea-2e85-b1f0-2ba2-e55f5538d2c3@redhat.com> (raw)
In-Reply-To: <20190708200250.12017-1-marcandre.lureau@redhat.com>

On 7/8/19 10:02 PM, Marc-André Lureau wrote:
> "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>
> ---
>  scripts/archive-source.sh | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
> index ca94e49978..fb5d6b3918 100755
> --- a/scripts/archive-source.sh
> +++ b/scripts/archive-source.sh
> @@ -39,14 +39,16 @@ function cleanup() {
>  }
>  trap "cleanup" 0 1 2 3 15
>  
> -if git diff-index --quiet HEAD -- &>/dev/null
> -then
> -    HEAD=HEAD
> -else
> -    HEAD=$(git stash create)
> -fi
> +function tree_ish() {
> +    local retval='HEAD'
> +    if ! git diff-index --quiet --ignore-submodules=all HEAD -- &>/dev/null
> +    then
> +        retval=$(git stash create)
> +    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"
>  for sm in $submodules; do
>      status="$(git submodule status "$sm")"
> @@ -62,7 +64,7 @@ for sm in $submodules; do
>              echo "WARNING: submodule $sm is out of sync"
>              ;;
>      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)"
>      tar --concatenate --file "$tar_file" "$sub_file"
>      test $? -ne 0 && error "failed append submodule $sm to $tar_file"
> 

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  reply	other threads:[~2019-07-13 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 20:02 [Qemu-devel] [PATCH] archive-source: also create a stash for submodules Marc-André Lureau
2019-07-13 15:49 ` Philippe Mathieu-Daudé [this message]
2019-07-15 14:36 ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b0c6aea-2e85-b1f0-2ba2-e55f5538d2c3@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).