Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] isOutdated() and lastModified()

On Sat, Dec 11, 2010 at 8:02 AM, Dmitry Pavlenko <dmit10@xxxxxxx> wrote:
> I seems that FileBasedConfig (and loose-refs-related classes) relies on
> java.io.File.lastModified() call (at least in isOutdated() method).

The following Gerrit changes try to fix this problem:

   http://egit.eclipse.org/r/2114
   http://egit.eclipse.org/r/2115
   http://egit.eclipse.org/r/2116
   http://egit.eclipse.org/r/2117
   http://egit.eclipse.org/r/2118
   http://egit.eclipse.org/r/2119

Unfortunately its a bit too accurate.  2117 ("FileBasedConfig: Use
FileSnapshot for isOutdated") shows an application programming bug
with regards to Repository getConfig().  Once this change goes into
JGit, applications cannot do:

  Repository db = ...;
  db.getConfig().setString(....);
  db.getConfig().save();

Because db.getConfig() might re-read the file and discard the set that
the application just performed.  Yikes, that's one heck of a breakage.

-- 
Shawn.


Back to the top