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 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.

> 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).

-- 
Shawn.


Back to the top