Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/git-plugin
  Commit: 71946a2896d3adcd1171ac59b7c45bacaf7a9c56
      
https://github.com/jenkinsci/git-plugin/commit/71946a2896d3adcd1171ac59b7c45bacaf7a9c56
  Author: Mark Waite <[email protected]>
  Date:   2016-07-30 (Sat, 30 Jul 2016)

  Changed paths:
    M src/main/java/hudson/plugins/git/util/GitUtils.java
    M src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java

  Log Message:
  -----------
  Prepare for git client plugin 2.0.0 coexistence

The git client plugin 2.0.0 release will switch from delivering JGit 3
to JGit 4.  JGit 4 requires Java 7 and provides Closeable implementations
of its methods that open external resources (like files).  JGit 4 removes
certain methods (like release()) because they are superseded by the JGit
4 Closeable implementation.

Other plugins depend on the git client plugin implementation of JGit.
They currently (correctly) assume the JGit provided by the git client
plugin is JGit 3.  If no changes are made to the plugins which depend on
the JGit provided by the git client plugin, those plugins will be broken
by the upgrade from JGit 3 to JGit 4.  They will report NoSuchMethodError
exceptions at run time or may report LinkageError exceptions during
class loading on some JVM implementations.

This change shows how a plugin which depends on the JGit provided with the
git client plugin can be adapted to run with either git client plugin 1.x
(JGit 3) to git client plugin 2.x (JGit 4).

This is a temporary change until the git plugin (and other plugins)
are updated to depend on git client plugin 2.0.  Once they depend on
git client plugin 2.0, this change can be reverted.

Uses reflection to find the close method of RevWalk and TreeWalk classes.
When RevWalk and TreeWalk from JGit 3 are loaded, their release()
methods are called.  When RevWalk and TreeWalk from JGit 4 are loaded,
their close() methods are called.

Use release(), not dispose() when ending AbstractGitSCMSource.retrieve()

The javadoc for dispose() hints that release() is a superset.
Using release() is consistent with the rest of the code (and with most
git-client-plugin usages).


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to