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

Re: [PATCH] t: make many tests depend less on the refs being files

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
May 21, 2018, 11:49 UTC
Message-ID
<20180521114940.11288-1-szeder.dev@gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1805211126140.77@tvgsbejvaqbjf.bet>
Show 15 quoted lines
> > diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> > index 8f5c811dd7..c3b89ae783 100755
> > --- a/t/t9903-bash-prompt.sh
> > +++ b/t/t9903-bash-prompt.sh
> > @@ -148,7 +148,7 @@ test_expect_success 'prompt - inside .git directory' '
> >  test_expect_success 'prompt - deep inside .git directory' '
> >  	printf " (GIT_DIR!)" >expected &&
> >  	(
> > -		cd .git/refs/heads &&
> > +		cd .git/objects &&
> >  		__git_ps1 >"$actual"
> >  	) &&
> >  	test_cmp expected "$actual"
> 
> This one looks wrong.
It's right, though.
> Why not `cd .git` instead?
That case is covered in the previous test.

Once upon a time it mattered how deep we were in the .git directory when running __git_ps1(), because it executed different branches of a long-ish if-elif chain. For the prompt it doesn't matter anymore, because those ifs were eliminated, but for the completion script it still does, which brings us to:

Christian! There is a similar test, '__git_find_repo_path - parent is a .git directory' in 't9902-completion.sh', which, too, performs a 'cd .git/refs/heads'.

Previous: Johannes SchindelinNext: Christian Couder
Message 3 of 8 in “t: make many tests depend less on the refs being files”
  1. t: make many tests depend less on the refs being filesChristian Couder, May 21, 2018
  2. Johannes SchindelinMay 21, 2018
  3. SZEDER GáborMay 21, 2018
  4. Christian CouderMay 23, 2018
  5. Christian CouderMay 21, 2018
  6. Johannes SchindelinMay 21, 2018
  7. Stefan BellerMay 21, 2018
  8. Christian CouderMay 23, 2018

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.