is commit normally slow [message #632708] |
Wed, 13 October 2010 21:46  |
Eclipse User |
|
|
|
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 #634838 is a reply to message #633464] |
Sun, 24 October 2010 08:33   |
Eclipse User |
|
|
|
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] |
Fri, 05 November 2010 20:01  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.05813 seconds