Skip to main content

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

12 dec 2010 kl. 20:40 skrev Shawn Pearce:

> On Sun, Dec 12, 2010 at 5:21 AM, Dmitry Pavlenko <dmit10@xxxxxxx> wrote:
>> Thank you for explanation. But I wonder if there's a method that says
>> Repository that config/a certain ref or all refs/index  is invalid and should
>> be updated if needed?
> I think you mean scanForRepoChanges() ?  I consider that method to be
> an abomination and would like to kill it from the API.  Right now
> because we don't have a good way to register for filesystem events
> from within Java, JGit applications need to periodically ask the
> Repository class about changes.  The whole thing is sort of a mess,
> because even scanForRepoChanges() isn't the best way we could have
> implemented this.

+1 That was a quick fix as was much of the early EGit. I wanted a certain
behahvior out of EGit and that seemed to work (mostly). Don't just kill, it.
We still want to be able to find out that things changed, but the bad thing
is that it can happen at almost any time now. Notifications should probably
only happen in the event loop and not in the middle of low-level JGit calls.

-- robin

>> If there's no such method it would be highly useful for
>> those who uses jgit as a library works with config/refs/index not only through
>> jgit calls but using some other quick methods (like git cli or FileWriter).
> Why are you writing directly to the git repository using FileWriter?
> You have the JGit library, and its capable of writing everything Git
> needs to write.  Why is your application bypassing it and using a
> FileWriter directly against the repository?
> I'm a little concerned that you would need to do that, because it
> means you are either misusing the library (in which case we need to
> clarify our examples/documentation/APIs) or you are missing an
> important feature (in which case we should implement that).  From my
> understanding of the Git repository file formats, FileWriter is
> probably the *wrong* way to write to a repository.  JGit never uses it
> in the library itself, it actually only turns up in 5 test cases (and
> I should file a bug to remove it from those too).

Second that. Don't asume working arround API deficiencies is the /right/ way
of solving problems. It might work, but then we'll be happy to break it at
any time :)

-- robin

Back to the top