Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] FS_Win32_Cygwin instantiation

Marc Strapetz <marc.strapetz@xxxxxxxxxxx> wrote:
> > If FS detects cygwin jgit forks to cygpath for file path translation.
> > 
> > Adding a another constructor parameter to allow overriding automatic
> > detection seems ok to me.
> The problem is that the FS is a static instance which is accessed from
> other core classes.


> So the constructor parameter has to passed through
> these classes.

Yup.  Sounds like that's what we need to do.

> As mentioned, a system property in the static{}-block within FS can do
> the job nearly as good, except of being able to re-configure your git
> installation while the application is running: you may think of a
> Preferences dialog where you can specify a Git executable. Changing this
> Git executable from Cygwin to non-Cygwin or vice versa would mean to
> restart the application to have these changes taking effect in FS.

Agreed.  A user should be able to reconfigure this without forcing
a restart of the application.

> > I do not see much benefit in moving userHome() to yet another utitlity class.
> It's a utility method and unrelated to "file system abstraction".

How you find the user's home directory, where their .ssh/config and
their .gitconfig is located, is file system dependent.  The home
on UNIX can come from the user.home Java system property, which is
usually from the HOME environment variable when the JVM launched.

But on Windows user.home probably points to a directory the user
doesn't even know about.  If you are using Cygwin, we probably want
to use the Cygwin home directory to access the Cygwin's .ssh/config
and .gitconfig, as the user has probably actually configured these.
Or at least knows where they are.  If on the other hand you are
using msysgit, we probably should use the msysgit notion of these
files instead.

Its not a utility method, its a file system abstraction function
to hide this nasty decision logic from the code that needs to get
to these files.


Back to the top