Bug 580910 - jgit logs to stdout
Summary: jgit logs to stdout
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 6.3   Edit
Hardware: PC Windows 10
: P3 minor (vote)
Target Milestone: 6.4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 553471 549246
Blocks:
  Show dependency tree
 
Reported: 2022-10-14 02:33 EDT by Jörg Kubitz CLA
Modified: 2022-10-25 01:44 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Kubitz CLA 2022-10-14 02:33:34 EDT
When using egit some hints from jgit are not visible to the user.
Example output from stdout:
"LFS built-in hook conflicts with existing pre-push hook in repository [RepositoryHandle:Repository[C:\ .... \.git]]. Either remove the pre-push hook or disable built-in LFS support.

	org.eclipse.jgit.hooks.Hooks.prePush(org.eclipse.jgit.lib.Repository, java.io.PrintStream) line: 135	
	org.eclipse.jgit.transport.TransportGitSsh(org.eclipse.jgit.transport.Transport).<init>(org.eclipse.jgit.lib.Repository, org.eclipse.jgit.transport.URIish) line: 808	
	org.eclipse.jgit.transport.TransportGitSsh(org.eclipse.jgit.transport.TcpTransport).<init>(org.eclipse.jgit.lib.Repository, org.eclipse.jgit.transport.URIish) line: 34	
	org.eclipse.jgit.transport.TransportGitSsh(org.eclipse.jgit.transport.SshTransport).<init>(org.eclipse.jgit.lib.Repository, org.eclipse.jgit.transport.URIish) line: 47	
	org.eclipse.jgit.transport.TransportGitSsh.<init>(org.eclipse.jgit.lib.Repository, org.eclipse.jgit.transport.URIish) line: 116	
	org.eclipse.jgit.transport.TransportGitSsh$1.open(org.eclipse.jgit.transport.URIish, org.eclipse.jgit.lib.Repository, java.lang.String) line: 106	
	org.eclipse.jgit.transport.Transport.open(org.eclipse.jgit.lib.Repository, org.eclipse.jgit.transport.URIish, java.lang.String) line: 520	
	org.eclipse.jgit.transport.Transport.open(org.eclipse.jgit.lib.Repository, java.lang.String, org.eclipse.jgit.transport.Transport$Operation) line: 273	
	org.eclipse.jgit.transport.Transport.open(org.eclipse.jgit.lib.Repository, java.lang.String) line: 243	
	org.eclipse.jgit.api.LsRemoteCommand.execute() line: 158	
	org.eclipse.jgit.api.LsRemoteCommand.call() line: 131	
	org.eclipse.egit.core.op.ListRemoteOperation.run(org.eclipse.core.runtime.IProgressMonitor) line: 116	
	org.eclipse.egit.ui.internal.components.AsynchronousBranchList(org.eclipse.egit.ui.internal.components.AsynchronousListOperation<T>).run(org.eclipse.core.runtime.IProgressMonitor) line: 76	
	org.eclipse.egit.ui.internal.dialogs.CancelableFuture$1.run(org.eclipse.core.runtime.IProgressMonitor) line: 280	
	org.eclipse.core.internal.jobs.Worker.run() line: 63	

If such messages are meant to be seen by the user they should be logged to error log view.
Specific to this warning: What is suggested? "remove the pre-push hook" or "disable built-in LFS support"? And what happens if i don't? And why does the user need to care when it still works with both?
Comment 1 Thomas Wolf CLA 2022-10-14 04:40:59 EDT
Eclipse platform still has no unified approach to pipe logs from slf4j and other logging frameworks to the OSGi log.

Two things I find strange here:

* Does it really log to stdout as in System.out? It should use the logger.
* Is this a stack trace? Why does LsRemoteCommand even look for the prePush hook?
Comment 2 Jörg Kubitz CLA 2022-10-14 05:48:26 EDT
I guess it's stdout, because i see that message in the console output when i run  eclipse in debug. The stacktrace is manually taken from a method breakpoint where that message string was found.
The debugger shows outputStream = null at that breakpoint.
Comment 3 Thomas Wolf CLA 2022-10-14 06:09:15 EDT
Indeed. 2 problems here in JGit, and one follow-up then in EGit:

1. Hook output streams are broken anyway in JGit: bug 549246.
2. That prePush hook is loaded way too early, so it gets loaded even for
   fetches.
3. Once (1) is corrected, EGit should see that streams for hooks are set
   correctly so that the result can be presented to the user somehow (log,
   or dialog, or whatever). See bug 553471.
Comment 4 Eclipse Genie CLA 2022-10-24 06:45:51 EDT
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/196467
Comment 5 Thomas Wolf CLA 2022-10-24 08:42:17 EDT
(In reply to Jörg Kubitz from comment #0)
> Example output from stdout:
> "LFS built-in hook conflicts with existing pre-push hook in repository
> [RepositoryHandle:Repository[C:\ .... \.git]]. Either remove the pre-push
> hook or disable built-in LFS support.

> Specific to this warning: What is suggested? "remove the pre-push hook" or
> "disable built-in LFS support"? And what happens if i don't? And why does
> the user need to care when it still works with both?

The built-in LFS pre-push hook will be used. Which should not be a problem if the external pre-push hook is also an LFS hook. But if it is some other hook and isn't called, it might be a problem. It's up to the user to decide what to do.