[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jgit-dev] Should FS become singleton-like?
|
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