Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Should FS become singleton-like?

The reason we were pushing FS down into APIs like Repository and its
dependencies is to allow a single JGit process to concurrently open
repositories on different drives, which may have different filesystem
semantics. On Windows this can be as simple as a repository under C:\
vs. a repository in your Cygwin home directory, also under C:\.

Does that also imply having two different system Git configs? What do you think of low-level FS.DETECTED usages -- is this something which should be cleaned up?

-Marc


On 02.01.2018 23:58, Shawn Pearce wrote:
The reason we were pushing FS down into APIs like Repository and its
dependencies is to allow a single JGit process to concurrently open
repositories on different drives, which may have different filesystem
semantics. On Windows this can be as simple as a repository under C:\
vs. a repository in your Cygwin home directory, also under C:\.

On Sat, Dec 30, 2017 at 4:57 AM, Marc Strapetz
<marc.strapetz@xxxxxxxxxxx> wrote:
I've just uploaded another FS-related patch [1] which is addressing problems
with LockFile (which became FS-dependent in version 4.5). I understand that
most developers didn't fall in love with the configurable FS-approach
started back in 2010: the idea was to not assume a single, auto-detectable
Git installation with a single system Git config, but to allow using a
custom (and possibly portable) Git installation and its system config by
using a custom FS implementation.

There are still 28 usages of FS.DETECTED in core org.eclipse.jgit production
code. Some of them are just default values for already FS-aware methods,
other usages are in central places, like:

FileSnapshot.save(): FS.lastModified()

or

FileUtils: FS.exists(), FS.retryFailedLockFileCommit(), FS.relativize(), ...

I guess similar as for FS.createNewFile() it could happen that their
implementations will become dependent on the system Git config and then new
problems will arise. Hence, my question:

Should FS become "singleton-like", defaulting to FS.DETECTED, but with an
additional setter so it can be (re)configured? I.e. something like:

class FS {
         private FS instance = detect();

         public FS getInstance() {
                 return instance;
         }

         public void setInstance(FS instance) {
                 this.instance = instance;
         }

         ...
}

This will still allow to use custom Git installations and even change them
during a program run; just not to use multiple Git installations
concurrently. It would allow to drop lots of FS parameters and fields and
help to simplify API somewhat. So something which could be done for version
5?

[1] https://git.eclipse.org/r/#/c/114826/

-Marc
_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/jgit-dev



Back to the top