You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Extend ALTERNATIVE_LOCATIONS for per-user installations
When `git` is not found in a `PATH` search on Windows, common
locations where Git for Windows is often installed are checked.
But only systemwide installations had been checked before.
This extends the locations examined to include the current user's
own program files directory. This directory, if present, is
expected to be the `Programs` subdirectory of the user's local
application data directory, typically:
C:\Users\<user>\AppData\Local\Programs
When Git for Windows is installed for a user rather than
systemwide, it is typically installed a `Git` subdirectory of that
`Programs` directory (much as it is typically installed in a `Git`
subdirectory of a directory such as `C:\Program Files` when
installed systemwide). This looks for a suitable Git for Windows
directory tree at such a location.
It is possible for Git for Windows installations to be present both
in the current user's own program files directory and systemwide.
If that happens, such that both kinds of installations are able to
be found, then we choose the per-user installation.
This is based on the idea that an individual user may choose to
install a newer or otherwise different version of Git for Windows,
or that a developer may even test out a custom build by manually
placing it in that directory. Because, in either case, the
architecture of the Git for Windows executable may differ from what
is currently installed systemwide or even from what is typically
preferred, we will attempt to use a per-user build of any of the
architectures Git for Windows has published, before then using the
systemwide installations as done before.
Although the user program files directory is under the local rather
than roaming application data directory, and is thus not shared
across machines on a domain, it is possible that some techniques of
backing up and restoring data may restore a per-user installation
of Git for Windows that is for a different machine architecture
that cannot run, or that the user would not want to be used. In
that case, this enhancement may actually break something that was
working before.
That seems fairly unlikely to occur, and it can be worked around by
making a `git` command available in a `PATH` search. Nonetheless,
if this is found to happen in practice, then further refinement of
the `ALTERNATIVE_LOCATIONS` enumeration order may be warranted.
0 commit comments