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

Re: [PATCH v2] setup: trace bare repository setups

From
Glen Choo <chooglen@google.com>
Date
Apr 28, 2023, 18:37 UTC
Message-ID
<kl6lbkj73laf.fsf@chooglen-macbookpro.roam.corp.google.com>
In-Reply-To
<b548d96db7052dc2cb664922fa2003fe068843cf.1682702058.git.steadmon@google.com>
Josh Steadmon <steadmon@google.com> writes:
Show 21 quoted lines
> diff --git a/t/t0035-safe-bare-repository.sh b/t/t0035-safe-bare-repository.sh
> index 11c15a48aa..993f5bdc7d 100755
> --- a/t/t0035-safe-bare-repository.sh
> +++ b/t/t0035-safe-bare-repository.sh
> @@ -7,13 +7,24 @@ TEST_PASSES_SANITIZE_LEAK=true
>  
>  pwd="$(pwd)"
>  
> -expect_accepted () {
> -	git "$@" rev-parse --git-dir
> +expect_accepted_implicit () {
> +	test_when_finished 'rm "$pwd/trace.perf"' &&
> +	GIT_TRACE2_PERF="$pwd/trace.perf" git "$@" rev-parse --git-dir &&
> +	grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
> +}
> +
> +expect_accepted_explicit () {
> +	test_when_finished 'rm "$pwd/trace.perf"' &&
> +	GIT_DIR="$1" GIT_TRACE2_PERF="$pwd/trace.perf" git rev-parse --git-dir &&
> +	! grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
>  }
(Not new in v2) This wasn't obvious to me at first, but
  grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"

looks like it's asserting that we trace that the bare repository is $pwd, but it's actually only asserting that is starts with $pwd. If it might trip up other reasers, a comment here would be helpful.

Show 8 quoted lines
> @@ -21,13 +32,9 @@ test_expect_success 'setup bare repo in worktree' '
>  	git init --bare outer-repo/bare-repo
>  '
>  
> -test_expect_success 'safe.bareRepository unset' '
> -	expect_accepted -C outer-repo/bare-repo
> -'
> -

I found this surprising; I thought it was quite valuable to test the default behavior. I'd prefer to keep this test.

Perhaps there was a miscommunication? You mentioned:
  Actually, explicitly setting the variable here is equivalent to the
  following test case, so I'll just remove this one.

which is true, but I think Junio meant _un_setting the variable, something like:

  test_expect_success 'safe.bareRepository unset' '
+   test_unconfig --global safe.bareRepository &&
    expect_accepted -C outer-repo/bare-repo
  '
Previous: Josh SteadmonNext: Josh Steadmon
Message 11 of 16 in “setup: trace bare repository setups”
  1. setup: trace bare repository setupsJosh Steadmon, Apr 27, 2023
  2. Junio C HamanoApr 27, 2023
  3. Josh SteadmonApr 28, 2023
  4. Josh SteadmonApr 28, 2023
  5. Junio C HamanoApr 28, 2023
  6. Josh SteadmonMay 1, 2023
  7. Glen ChooMay 8, 2023
  8. Glen ChooApr 27, 2023
  9. Josh SteadmonApr 28, 2023
  10. setup: trace bare repository setupsJosh Steadmon, Apr 28, 2023
  11. Glen ChooApr 28, 2023
  12. Josh SteadmonMay 1, 2023
  13. setup: trace bare repository setupsJosh Steadmon, May 1, 2023
  14. Junio C HamanoMay 5, 2023
  15. Taylor BlauMay 8, 2023
  16. Josh SteadmonMay 10, 2023

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.