[01/12] t5319: fix bogus cat-file argument
diff mbox series

Message ID 20190404232203.GA21839@sigill.intra.peff.net
State New
Headers show
Series
  • a rabbit hole of update-server-info fixes
Related show

Commit Message

Jeff King April 4, 2019, 11:22 p.m. UTC
There's no such argument as "--unordered"; it's spelled "--unsorted".
But our test failed to notice that cat-file didn't run at all because:

  1. It lost the exit code of git on the left-hand side of a pipe.

  2. It was comparing two runs of the broken invocation with and without
     a particular config variable (and indeed, both cases produced no
     output!).

Let's fix the option, but also tweak the helper function to check the
exit code.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5319-multi-pack-index.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Ramsay Jones April 5, 2019, 12:44 a.m. UTC | #1
On 05/04/2019 00:22, Jeff King wrote:
> There's no such argument as "--unordered"; it's spelled "--unsorted".

Err, isn't this back-to-front? (i.e. cat-file has the _option_
"--unordered" but not "--unsorted").

I suspect that I am not reading that right! :-D

ATB,
Ramsay Jones
Jeff King April 5, 2019, 1:41 a.m. UTC | #2
On Fri, Apr 05, 2019 at 01:44:09AM +0100, Ramsay Jones wrote:

> 
> 
> On 05/04/2019 00:22, Jeff King wrote:
> > There's no such argument as "--unordered"; it's spelled "--unsorted".
> 
> Err, isn't this back-to-front? (i.e. cat-file has the _option_
> "--unordered" but not "--unsorted").

Oops, yes. The patch is right; we are going the other way.

Sorry for the confusion.

-Peff
Jeff King April 5, 2019, 1:46 a.m. UTC | #3
On Thu, Apr 04, 2019 at 09:41:10PM -0400, Jeff King wrote:

> On Fri, Apr 05, 2019 at 01:44:09AM +0100, Ramsay Jones wrote:
> 
> > 
> > 
> > On 05/04/2019 00:22, Jeff King wrote:
> > > There's no such argument as "--unordered"; it's spelled "--unsorted".
> > 
> > Err, isn't this back-to-front? (i.e. cat-file has the _option_
> > "--unordered" but not "--unsorted").
> 
> Oops, yes. The patch is right; we are going the other way.

Reading my response I might have been unclear again. :) I mean the
actual diff text of the patch is doing the right thing. It's just the
description here which is wrong.

-Peff

Patch
diff mbox series

diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 70926b5bc0..42f4d6cd01 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -86,13 +86,14 @@  test_expect_success 'write midx with one v1 pack' '
 '
 
 midx_git_two_modes () {
+	git -c core.multiPackIndex=false $1 >expect &&
+	git -c core.multiPackIndex=true $1 >actual &&
 	if [ "$2" = "sorted" ]
 	then
-		git -c core.multiPackIndex=false $1 | sort >expect &&
-		git -c core.multiPackIndex=true $1 | sort >actual
-	else
-		git -c core.multiPackIndex=false $1 >expect &&
-		git -c core.multiPackIndex=true $1 >actual
+		sort <expect >expect.sorted &&
+		mv expect.sorted expect &&
+		sort <actual >actual.sorted &&
+		mv actual.sorted actual
 	fi &&
 	test_cmp expect actual
 }
@@ -104,7 +105,7 @@  compare_results_with_midx () {
 		midx_git_two_modes "log --raw" &&
 		midx_git_two_modes "count-objects --verbose" &&
 		midx_git_two_modes "cat-file --batch-all-objects --buffer --batch-check" &&
-		midx_git_two_modes "cat-file --batch-all-objects --buffer --batch-check --unsorted" sorted
+		midx_git_two_modes "cat-file --batch-all-objects --buffer --batch-check --unordered" sorted
 	'
 }