git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] test-lib: set $DIFF to diff if it is unset
@ 2010-06-10  9:39 Thomas Rast
  2010-06-10  9:46 ` Ævar Arnfjörð Bjarmason
  2010-06-10 17:23 ` Brandon Casey
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Rast @ 2010-06-10  9:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Since 7b3bdbb (fixup: do not unconditionally disable "diff -u",
2010-05-31), test-lib.sh depends on having $DIFF set in the
environment for the construction of $GIT_TEST_CMP.  While this works
when called from the main Makefile, it fails if the tests are called
on their own and the user does not have $DIFF set.

Set it to 'diff' if it is unset, like the Makefile does.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

I have an uneasy feeling that I must be missing something, seeing as
this went unnoticed for 10 days...

 t/test-lib.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index b23a61d..4d89049 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -78,6 +78,7 @@ export EDITOR
 
 if test -z "$GIT_TEST_CMP"
 then
+	DIFF=${DIFF:-diff}
 	if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
 	then
 		GIT_TEST_CMP="$DIFF -c"
-- 
1.7.1.550.g553ab5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-10  9:39 [PATCH next] test-lib: set $DIFF to diff if it is unset Thomas Rast
@ 2010-06-10  9:46 ` Ævar Arnfjörð Bjarmason
  2010-06-10 17:23 ` Brandon Casey
  1 sibling, 0 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-06-10  9:46 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, git

On Thu, Jun 10, 2010 at 09:39, Thomas Rast <trast@student.ethz.ch> wrote:
> Since 7b3bdbb (fixup: do not unconditionally disable "diff -u",
> 2010-05-31), test-lib.sh depends on having $DIFF set in the
> environment for the construction of $GIT_TEST_CMP.  While this works
> when called from the main Makefile, it fails if the tests are called
> on their own and the user does not have $DIFF set.
>
> Set it to 'diff' if it is unset, like the Makefile does.
>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
>
> I have an uneasy feeling that I must be missing something, seeing as
> this went unnoticed for 10 days...

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

I spotted it too when preparing the TAP series, I just didn't submit a
fix for it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-10  9:39 [PATCH next] test-lib: set $DIFF to diff if it is unset Thomas Rast
  2010-06-10  9:46 ` Ævar Arnfjörð Bjarmason
@ 2010-06-10 17:23 ` Brandon Casey
  2010-06-11 16:15   ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Brandon Casey @ 2010-06-10 17:23 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, git

On 06/10/2010 04:39 AM, Thomas Rast wrote:
> Since 7b3bdbb (fixup: do not unconditionally disable "diff -u",
> 2010-05-31), test-lib.sh depends on having $DIFF set in the
> environment for the construction of $GIT_TEST_CMP.  While this works
> when called from the main Makefile, it fails if the tests are called
> on their own and the user does not have $DIFF set.
> 
> Set it to 'diff' if it is unset, like the Makefile does.
> 
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
> 
> I have an uneasy feeling that I must be missing something, seeing as
> this went unnoticed for 10 days...
> 
>  t/test-lib.sh |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index b23a61d..4d89049 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -78,6 +78,7 @@ export EDITOR
>  
>  if test -z "$GIT_TEST_CMP"
>  then
> +	DIFF=${DIFF:-diff}
>  	if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
>  	then
>  		GIT_TEST_CMP="$DIFF -c"

I think what should be done instead, is to move this section
down below the line where GIT-BUILD-OPTIONS is sourced.  That
way, the value of $DIFF can be gotten from that file.

I guess GIT_TEST_CMP and GIT_TEST_CMP_USE_COPIED_CONTEXT
should be written into GIT-BUILD-OPTIONS too.

-brandon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-10 17:23 ` Brandon Casey
@ 2010-06-11 16:15   ` Junio C Hamano
  2010-06-11 16:26     ` Brandon Casey
  2010-06-11 16:34     ` Thomas Rast
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2010-06-11 16:15 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Thomas Rast, git

Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:

> I think what should be done instead, is to move this section
> down below the line where GIT-BUILD-OPTIONS is sourced.  That
> way, the value of $DIFF can be gotten from that file.
>
> I guess GIT_TEST_CMP and GIT_TEST_CMP_USE_COPIED_CONTEXT
> should be written into GIT-BUILD-OPTIONS too.

I like that.  Something like this?

 Makefile      |    6 ++++++
 t/test-lib.sh |   20 ++++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 0367e8a..6b3b59b 100644
--- a/Makefile
+++ b/Makefile
@@ -1944,6 +1944,12 @@ GIT-BUILD-OPTIONS: FORCE
 	@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
 	@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
 	@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
+ifdef GIT_TEST_CMP
+	@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
+endif
+ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
+	@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
+endif
 
 ### Detect Tck/Tk interpreter path changes
 ifndef NO_TCLTK
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a290011..eafe146 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -64,16 +64,6 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR
 
-if test -z "$GIT_TEST_CMP"
-then
-	if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
-	then
-		GIT_TEST_CMP="$DIFF -c"
-	else
-		GIT_TEST_CMP="$DIFF -u"
-	fi
-fi
-
 # Protect ourselves from common misconfiguration to export
 # CDPATH into the environment
 unset CDPATH
@@ -691,6 +681,16 @@ export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOB
 
 . ../GIT-BUILD-OPTIONS
 
+if test -z "$GIT_TEST_CMP"
+then
+	if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
+	then
+		GIT_TEST_CMP="$DIFF -c"
+	else
+		GIT_TEST_CMP="$DIFF -u"
+	fi
+fi
+
 GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
 export GITPERLLIB
 test -d ../templates/blt || {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-11 16:15   ` Junio C Hamano
@ 2010-06-11 16:26     ` Brandon Casey
  2010-06-15 15:19       ` Brandon Casey
  2010-06-11 16:34     ` Thomas Rast
  1 sibling, 1 reply; 7+ messages in thread
From: Brandon Casey @ 2010-06-11 16:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git

On 06/11/2010 11:15 AM, Junio C Hamano wrote:
> Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
> 
>> I think what should be done instead, is to move this section
>> down below the line where GIT-BUILD-OPTIONS is sourced.  That
>> way, the value of $DIFF can be gotten from that file.
>>
>> I guess GIT_TEST_CMP and GIT_TEST_CMP_USE_COPIED_CONTEXT
>> should be written into GIT-BUILD-OPTIONS too.
> 
> I like that.  Something like this?

Looks good, will test.

-brandon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-11 16:15   ` Junio C Hamano
  2010-06-11 16:26     ` Brandon Casey
@ 2010-06-11 16:34     ` Thomas Rast
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Rast @ 2010-06-11 16:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brandon Casey, git

Junio C Hamano wrote:
> Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
> 
> > I think what should be done instead, is to move this section
> > down below the line where GIT-BUILD-OPTIONS is sourced.  That
> > way, the value of $DIFF can be gotten from that file.
> >
> > I guess GIT_TEST_CMP and GIT_TEST_CMP_USE_COPIED_CONTEXT
> > should be written into GIT-BUILD-OPTIONS too.
> 
> I like that.  Something like this?

Fine by me, and tested.

Acked-by: Thomas Rast <trast@student.ethz.ch>

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH next] test-lib: set $DIFF to diff if it is unset
  2010-06-11 16:26     ` Brandon Casey
@ 2010-06-15 15:19       ` Brandon Casey
  0 siblings, 0 replies; 7+ messages in thread
From: Brandon Casey @ 2010-06-15 15:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git

On 06/11/2010 11:26 AM, Brandon Casey wrote:
> On 06/11/2010 11:15 AM, Junio C Hamano wrote:
>> Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
>>
>>> I think what should be done instead, is to move this section
>>> down below the line where GIT-BUILD-OPTIONS is sourced.  That
>>> way, the value of $DIFF can be gotten from that file.
>>>
>>> I guess GIT_TEST_CMP and GIT_TEST_CMP_USE_COPIED_CONTEXT
>>> should be written into GIT-BUILD-OPTIONS too.
>> I like that.  Something like this?
> 
> Looks good, will test.

Works for me.  It's kind of belated, I know.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-15 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10  9:39 [PATCH next] test-lib: set $DIFF to diff if it is unset Thomas Rast
2010-06-10  9:46 ` Ævar Arnfjörð Bjarmason
2010-06-10 17:23 ` Brandon Casey
2010-06-11 16:15   ` Junio C Hamano
2010-06-11 16:26     ` Brandon Casey
2010-06-15 15:19       ` Brandon Casey
2010-06-11 16:34     ` Thomas Rast

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).