diff mbox

[1/6] tests/docker: fix make-archive-maybe

Message ID 1465224417-141321-2-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini June 6, 2016, 2:46 p.m. UTC
make-archive-maybe expects an archive path relative
to $1, but receives a path relative to the current directory.  Redirect
the output outside the subshell to bypass the "cd $1".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/Makefile.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Fam Zheng June 7, 2016, 2:41 a.m. UTC | #1
On Mon, 06/06 16:46, Paolo Bonzini wrote:
> make-archive-maybe expects an archive path relative
> to $1, but receives a path relative to the current directory.  Redirect
> the output outside the subshell to bypass the "cd $1".
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  tests/docker/Makefile.include | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 2fd2ca3..d0ad36c 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -21,10 +21,10 @@ IMAGES ?= %
>  make-archive-maybe = $(if $(wildcard $1/*), \
>  	$(call quiet-command, \
>  		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
> -			git archive -1 HEAD --format=tar.gz -o $2; \
> +			git archive -1 HEAD --format=tar.gz; \
>  		else \
> -			git archive -1 $$(git stash create) --format=tar.gz -o $2; \
> -		fi), \
> +			git archive -1 $$(git stash create) --format=tar.gz; \
> +		fi) > $2, \
>  		"  ARCHIVE $(notdir $2)"))
>  
>  CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
> -- 
> 1.8.3.1
> 
> 

I think this is better than my patch because it also reduces the duplication
between the two "git archive" commands a little. So I'm dropping mine.

Fam
diff mbox

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 2fd2ca3..d0ad36c 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -21,10 +21,10 @@  IMAGES ?= %
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
 		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
-			git archive -1 HEAD --format=tar.gz -o $2; \
+			git archive -1 HEAD --format=tar.gz; \
 		else \
-			git archive -1 $$(git stash create) --format=tar.gz -o $2; \
-		fi), \
+			git archive -1 $$(git stash create) --format=tar.gz; \
+		fi) > $2, \
 		"  ARCHIVE $(notdir $2)"))
 
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)