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

Re: [PATCH 4/6] config: return configset value for current_config_ functions

From
Jeff King <peff@peff.net>
Date
May 19, 2016, 00:08 UTC
Message-ID
<20160519000821.GA22543@sigill.intra.peff.net>
In-Reply-To
<20160518224323.GD22443@sigill.intra.peff.net>
On Wed, May 18, 2016 at 06:43:23PM -0400, Jeff King wrote:
Show 9 quoted lines
>  cache.h                |  1 +
>  config.c               | 51 +++++++++++++++++++++++++++++++++++++++++---------
>  t/helper/test-config.c | 20 ++++++++++++++++++++
>  t/t1308-config-set.sh  | 23 +++++++++++++++++++++++
> [...]
> +test_expect_success 'iteration shows correct origins' '
> +	echo "[alias]test-config = !test-config" >.gitconfig &&
> [...]
> +	git -c foo.bar=from-cmdline test-config iterate >actual &&

While writing and testing this, I got bit by e6e7530 (test helpers: move test-* to t/helper/ subdirectory, 2016-04-13). I had an old test-config binary leftover in the root of my repository, and the new one was correctly built in t/helper/. Running "test-config" is fine, but inside the git alias, it sticks the repository root at the front of $PATH (because it's the exec-path). And so it ran the old version of test-config, which did not understand my new "iterate" option.

Now I'll admit what I'm doing here is pretty funny (running test-* from an alias). I'm doing it because I want to see how the program operates with the "-c" config, and it's nicer to spell it as a user would, instead of munging $GIT_CONFIG_PARAMETERS directly.

So I'm not sure if it's worth working around or not. The single tree state produced by this commit is fine, but it does behave badly if there's leftover cruft from a pre-e6e7530 build. A more robust version would look more like:

  sq=\' ;# to ease quoting later
  ...
  GIT_CONFIG_PARAMETERS=${sq}foo.bar=from-cmdline${sq} test-config ...
Which is ugly, but it's probably worth it to avoid the flakiness.

The other option is to somehow make bin-wrappers more robust. E.g., it would be nice if we didn't actually point into the repository root directly, but rather somehow linked all of the git-* entries that _would_ be installed into the exec-path into a fake exec-path (or alternatively, actually build them directly into that fake exec-path).

That's a much bigger change, though. Given how unlikely the sequence of steps in my test is, maybe it's better to just work around it in this one case.

-Peff
Previous: Jeff KingNext: Duy Nguyen
Message 6 of 23 in “pack-objects hook for upload-pack”
  1. 0/6 pack-objects hook for upload-packJeff King, May 18, 2016
  2. 1/6 git_config_with_options: drop "found" countingJeff King, May 18, 2016
  3. 2/6 git_config_parse_parameter: refactor cleanup codeJeff King, May 18, 2016
  4. 3/6 config: set up config_source for command-line configJeff King, May 18, 2016
  5. 4/6 config: return configset value for current_config_ functionsJeff King, May 18, 2016
  6. Jeff KingMay 19, 2016
  7. Duy NguyenMay 26, 2016
  8. Junio C HamanoMay 26, 2016
  9. Jeff KingMay 26, 2016
  10. Junio C HamanoMay 26, 2016
  11. Jeff KingMay 27, 2016
  12. Junio C HamanoMay 27, 2016
  13. Jeff KingMay 27, 2016
  14. 5/6 config: add a notion of "scope"Jeff King, May 18, 2016
  15. 6/6 upload-pack: provide a hook for running pack-objectsJeff King, May 18, 2016
  16. Jeff KingMay 19, 2016
  17. Ævar Arnfjörð BjarmasonMay 19, 2016
  18. Jeff KingMay 19, 2016
  19. Ævar Arnfjörð BjarmasonMay 19, 2016
  20. Jeff KingMay 26, 2016
  21. Junio C HamanoMay 25, 2016
  22. Jeff KingMay 26, 2016
  23. Junio C HamanoMay 26, 2016

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.