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

Re: [PATCH v2 1/3] difftool: eliminate use of global variables

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 7, 2025, 06:28 UTC
Message-ID
<Z6WoDpX5bvXa21qo@pks.im>
In-Reply-To
<CABPp-BHpqSRy=G4HB+QtbFuP8Bohw6Cd99va2++PawehCDt0Aw@mail.gmail.com>
On Thu, Feb 06, 2025 at 10:08:29AM -0800, Elijah Newren wrote:
Show 21 quoted lines
> On Thu, Feb 6, 2025 at 5:34 AM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > David Aguilar <davvid@gmail.com> writes:
> >
> > > Move difftool's global variables into a difftools_option struct
> > > in preparation for removal of USE_THE_REPOSITORY_VARIABLE.
> >
> > Both may be good things, but I am puzzled by the "in preparation
> > for" part of the above description.  Would it require we lose these
> > three global variables if we wanted to pass through a repository
> > instance through the callchain instead of relying on implicit use of
> > the_repository?
> >
> > Aren't these pretty much independent and orthogonal?
> 
> The declaration of 'extern int has_symlinks;' in environment.h is
> guarded by an #ifdef USE_THE_REPOSITORY_VARIABLE, so if you want to
> stop declaring that, you need to both pass a repository through and
> stop using that global variable.  (The change to trust_exit_code and
> symlinks vars do seem to be independent, but kind of make sense to
> handle at the same time you are changing how has_symlinks is treated.)

Ah, that makes sense. It raises the question whether the refactoring thus breaks something because we don't use that global variable anymore, e.g. if we were munging it in the preimage. But as far as I can see we don't modify it at all, so this should be fine.

Patrick
Previous: Junio C Hamano
Message 13 of 13 in “difftool: eliminate use of global variables”
  1. 1/3 difftool: eliminate use of global variablesDavid Aguilar, Feb 6, 2025
  2. 2/3 difftool: eliminate use of the_repositoryDavid Aguilar, Feb 6, 2025
  3. Elijah NewrenFeb 6, 2025
  4. 3/3 difftool: eliminate use of USE_THE_REPOSITORY_VARIABLEDavid Aguilar, Feb 6, 2025
  5. Elijah NewrenFeb 6, 2025
  6. Patrick SteinhardtFeb 7, 2025
  7. Junio C HamanoFeb 7, 2025
  8. Elijah NewrenFeb 6, 2025
  9. David AguilarFeb 7, 2025
  10. Junio C HamanoFeb 6, 2025
  11. Elijah NewrenFeb 6, 2025
  12. Junio C HamanoFeb 6, 2025
  13. Patrick SteinhardtFeb 7, 2025

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.