Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » is commit normally slow
is commit normally slow [message #632708] Thu, 14 October 2010 01:46 Go to next message
Bruno  is currently offline Bruno
Messages: 4
Registered: October 2010
Junior Member
Hi,

I'm trying out jGit for the first times. I'm integrating it on a plugin so that I can automatically commit when the user saves any file.

In my firt tests, that I made following the user guide [1], the commit is taking 7 secconds to execute. Am I doing something wrong or this time is normal?

Here's my code:

		File basedir = new File("test/basedir");
		deleteFileTree(basedir);
		basedir.mkdir();
		
		RepositoryBuilder builder = new RepositoryBuilder();
		builder.setGitDir(new File(basedir, ".git"));
		
		Repository repo = builder.build();
		repo.create();

		Git git = new Git(repo);
		
		new File(basedir, "aa").createNewFile();
		
		git.add().addFilepattern(".").call();
		
		long t1 = System.currentTimeMillis();
		
		git.commit()
			.setAll(true)
			.setMessage("besouro automatic message")
			.setCommitter("somename", "someemail")
			.call();

		
		long t2 = System.currentTimeMillis();
		
		// Its printing 7 for me :-o
		System.out.println((t2-t1)/1000);



Thanks in advance!

[1] http://wiki.eclipse.org/JGit/User_Guide

Re: is commit normally slow [message #632947 is a reply to message #632708] Thu, 14 October 2010 18:11 Go to previous messageGo to next message
Bruno  is currently offline Bruno
Messages: 4
Registered: October 2010
Junior Member
Ops, Surprised

Strange... I closed my notebook yesterday, opened today, ran the same test and the commit happened in 0sec... :-/

What might that be?!
Re: is commit normally slow [message #633229 is a reply to message #632708] Fri, 15 October 2010 18:52 Go to previous messageGo to next message
Bruno  is currently offline Bruno
Messages: 4
Registered: October 2010
Junior Member
humm..

Guess I have a relevant info now.

When I'm at home, with available network, commit lasts for 7 secconds.
When I disconnect from the internet, it runs in 0 seconds... :-/

Is the jgit library looking for some remote resource, like XML Schemas or so? Should it be doing that?
Re: is commit normally slow [message #633464 is a reply to message #633229] Mon, 18 October 2010 06:46 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias Sohn
Messages: 588
Registered: July 2009
Senior Member
Could you create some thread dumps during these 7 sec to get some hint what's going on here ?
Re: is commit normally slow [message #634838 is a reply to message #633464] Sun, 24 October 2010 12:33 Go to previous messageGo to next message
Bruno  is currently offline Bruno
Messages: 4
Registered: October 2010
Junior Member
I got this using the eclipse debugger. I think its helpful:

Daemon Thread [Thread-0] (Suspended)
Inet6AddressImpl.getHostByAddr(byte[]) line: not available [native method]
InetAddress$1.getHostByAddr(byte[]) line: 843
InetAddress.getHostFromNameService(InetAddress, boolean) line: 533
Inet4Address(InetAddress).getCanonicalHostName() line: 504
SystemReader$1.getHostname() line: 84
UserConfig.getEmailInternal(Config, String) line: 146
UserConfig.<init>(Config) line: 69
UserConfig.<init>(Config, UserConfig$1) line: 51
UserConfig$1.parse(Config) line: 55
UserConfig$1.parse(Config) line: 53
FileBasedConfig(Config).get(SectionParser<T>) line: 530
PersonIdent.<init>(Repository) line: 78
RefDirectory.log(RefUpdate, String, boolean) line: 558
RefDirectoryUpdate.doUpdate(RefUpdate$Result) line: 116
RefUpdate$1.execute(RefUpdate$Result) line: 471
RefDirectoryUpdate(RefUpdate).updateImpl(RevWalk, RefUpdate$Store) line: 595
RefDirectoryUpdate(RefUpdate).update(RevWalk) line: 466
RefDirectoryUpdate(RefUpdate).update() line: 445
CommitCommand.call() line: 190
JGitTest.shouldCommit() line: 100
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 592
FrameworkMethod$1.runReflectiveCall() line: 44
FrameworkMethod$1(ReflectiveCallable).run() line: 15
FrameworkMethod.invokeExplosively(Object, Object...) line: 41
InvokeMethod.evaluate() line: 20
RunBefores.evaluate() line: 28
RunAfters.evaluate() line: 31
BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 76
BlockJUnit4ClassRunner.runChild(Object, RunNotifier) line: 50
ParentRunner$3.run() line: 193
ParentRunner$1.schedule(Runnable) line: 52
BlockJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 191
ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 42
ParentRunner$2.evaluate() line: 184
BlockJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 236
JUnit4TestClassReference(JUnit4TestReference).run(TestExecut ion) line: 49
TestExecution.run(ITestReference[]) line: 38
RemoteTestRunner.runTests(String[], String, TestExecution) line: 467
RemoteTestRunner.runTests(TestExecution) line: 683
RemoteTestRunner.run() line: 390
RemoteTestRunner.main(String[]) line: 197
Re: is commit normally slow [message #637513 is a reply to message #634838] Sat, 06 November 2010 00:01 Go to previous message
Matthias Sohn is currently offline Matthias Sohn
Messages: 588
Registered: July 2009
Senior Member
This points to the fact that you didn't configure user.email and probably also user.name in the configuration of your git repository. JGit will then try to construct your mail address by concatenating your userID on your system and the hostname you run jgit on. See line 140 in UserConfig.java. Hence explicitly setting these configuration parameters should fix your problem.
Previous Topic:Getting "invalid server's version string" with git+ssh?
Next Topic:My workflow - what am I doing wrong?
Goto Forum:
  


Current Time: Fri Oct 24 14:56:17 GMT 2014

Powered by FUDForum. Page generated in 0.02034 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software