git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] t1600-index: remove unnecessary redirection

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 17, 2021, 18:39 UTC
Message-ID
<20210817183917.GC2257957@szeder.dev>
In-Reply-To
<d8d8d59a-ecac-2cd5-18a3-f1cb65e48c2e@gmail.com>
On Tue, Aug 17, 2021 at 02:12:36PM -0400, Derrick Stolee wrote:
Show 31 quoted lines
> On 8/17/2021 1:49 PM, SZEDER Gábor wrote:
> > In a helper function in the 't1600-index.sh' test script the stderr
> > of a 'git add' command is redirected to its stdout, but its stdout is
> > not redirected anywhere.  So apparently this redirection is
> > unnecessary, remove it.
> > 
> > Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> > ---
> >  t/t1600-index.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/t/t1600-index.sh b/t/t1600-index.sh
> > index c9b9e718b8..5d10cec67a 100755
> > --- a/t/t1600-index.sh
> > +++ b/t/t1600-index.sh
> > @@ -79,7 +79,7 @@ test_index_version () {
> >  		else
> >  			unset GIT_INDEX_VERSION
> >  		fi &&
> > -		git add a 2>&1 &&
> > +		git add a &&
> >  		echo $EXPECTED_OUTPUT_VERSION >expect &&
> >  		test-tool index-version <.git/index >actual &&
> >  		test_cmp expect actual
> 
> Since here we have a 'test_cmp expect actual', perhaps the
> actual mistake is that the line isn't
> 
> 	git add a 2>&1 >actual &&
> 
> What do you think about that?
The actual file is written two lines later as:
  test-tool index-version <.git/index >actual

So it seems that neither stdout nor stderr of that 'git add' command matters.

However, in most of the preceeding tests 'git add's stderr does indeed matter, as they do:

    git add a 2>&1 | sed "s/[0-9]//" >actual.err &&
    # write expect.err
    test_cmp expect.err actual.err

I suspect that the 2>&1 redirection this patch is removing might have been a copy-paste error.

Previous: Derrick StoleeNext: Derrick Stolee
Message 4 of 23 in “Fix GIT_TEST_SPLIT_INDEX”
  1. 0/6 Fix GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 17, 2021
  2. 1/6 t1600-index: remove unnecessary redirectionSZEDER Gábor, Aug 17, 2021
  3. Derrick StoleeAug 17, 2021
  4. SZEDER GáborAug 17, 2021
  5. Derrick StoleeAug 17, 2021
  6. 2/6 t1600-index: don't run git commands upstream of a pipeSZEDER Gábor, Aug 17, 2021
  7. 3/6 t1600-index: disable GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 17, 2021
  8. 4/6 read-cache: look for shared index files next to the index, tooSZEDER Gábor, Aug 17, 2021
  9. 5/6 tests: disable GIT_TEST_SPLIT_INDEX for sparse index testsSZEDER Gábor, Aug 17, 2021
  10. Derrick StoleeAug 17, 2021
  11. SZEDER GáborAug 17, 2021
  12. Derrick StoleeAug 18, 2021
  13. 6/6 read-cache: fix GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 17, 2021
  14. Derrick StoleeAug 17, 2021
  15. 0/6 Fix GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 26, 2021
  16. 1/6 t1600-index: remove unnecessary redirectionSZEDER Gábor, Aug 26, 2021
  17. 2/6 t1600-index: don't run git commands upstream of a pipeSZEDER Gábor, Aug 26, 2021
  18. 3/6 t1600-index: disable GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 26, 2021
  19. 4/6 read-cache: look for shared index files next to the index, tooSZEDER Gábor, Aug 26, 2021
  20. 6/6 read-cache: fix GIT_TEST_SPLIT_INDEXSZEDER Gábor, Aug 26, 2021
  21. 5/6 tests: disable GIT_TEST_SPLIT_INDEX for sparse index testsSZEDER Gábor, Aug 26, 2021
  22. Derrick StoleeAug 31, 2021
  23. Junio C HamanoAug 31, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.