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

Re: [PATCH 06/16] diff: always try to set up the repository

From
Jeff King <peff@peff.net>
Date
Sep 13, 2016, 22:22 UTC
Message-ID
<20160913222144.f3f3oqhqbe6sjzdf@sigill.intra.peff.net>
In-Reply-To
<CAGZ79kYNfUmBG+9irQoZ+C6qfiiz0P7pGKHZVk-8569gk4+_EQ@mail.gmail.com>
On Tue, Sep 13, 2016 at 03:00:17PM -0700, Stefan Beller wrote:
Show 13 quoted lines
> On Mon, Sep 12, 2016 at 8:23 PM, Jeff King <peff@peff.net> wrote:
> 
> >   2. If you're in a subdirectory of a repository, then we
> >      still try to read ".git/config", but it generally
> >      doesn't exist. So "diff --no-index" there does not
> >      respect repo config.
> 
> Nit:
> So IIUC your cover letter even this /used/ to work but
> broke only recently? So I feel like the message is a bit
> misleading (i.e. you argue for a change in behavior instead of
> calling it a bug fix for a regression. I think a bug fix for a regression
> is harder to revert as compared to a "new" behavior)

No, this has always been broken. What broke recently is the tests covered in patch 14 related to git-init.

IOW, we have always done this "blind read" of .git/config, ever since the early days. It was always wrong, but was mostly overlooked because it worked often enough and usually didn't cause other problems. But because of the caching and lazy-reading done by git_config() these days (and get_shared_repository() which builds on it), you can get quite confusing and buggy effects if you lazy-read at the wrong time.

-Peff
Previous: Stefan BellerNext: Jeff King
Message 7 of 23 in “fix config-reading in non-repos”
  1. 0/16 fix config-reading in non-reposJeff King, Sep 13, 2016
  2. 01/16 t1007: factor out repeated setupJeff King, Sep 13, 2016
  3. Stefan BellerSep 13, 2016
  4. 02/16 hash-object: always try to set up the git repositoryJeff King, Sep 13, 2016
  5. 06/16 diff: always try to set up the repositoryJeff King, Sep 13, 2016
  6. Stefan BellerSep 13, 2016
  7. Jeff KingSep 13, 2016
  8. 04/16 diff: skip implicit no-index check when given --no-indexJeff King, Sep 13, 2016
  9. 07/16 pager: remove obsolete commentJeff King, Sep 13, 2016
  10. 03/16 patch-id: use RUN_SETUP_GENTLYJeff King, Sep 13, 2016
  11. 05/16 diff: handle --no-index prefixes consistentlyJeff King, Sep 13, 2016
  12. 08/16 pager: stop loading git_default_config()Jeff King, Sep 13, 2016
  13. 09/16 pager: make pager_program a file-local staticJeff King, Sep 13, 2016
  14. 10/16 pager: use callbacks instead of configsetJeff King, Sep 13, 2016
  15. 11/16 pager: handle early configJeff King, Sep 13, 2016
  16. 12/16 t1302: use "git -C"Jeff King, Sep 13, 2016
  17. 13/16 test-config: setup git directoryJeff King, Sep 13, 2016
  18. 14/16 config: only read .git/config from configured reposJeff King, Sep 13, 2016
  19. 15/16 init: expand comments explaining config trickeryJeff King, Sep 13, 2016
  20. 16/16 init: reset cached config when entering new repoJeff King, Sep 13, 2016
  21. Stefan BellerSep 13, 2016
  22. Dennis KaarsemakerSep 14, 2016
  23. Jeff KingSep 14, 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.