Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new command: UnsupportedCommand to communicate compatibility of JGit #594

Merged

Conversation

rishabhBudhouliya
Copy link
Contributor

@rishabhBudhouliya rishabhBudhouliya commented Aug 4, 2020

This command serves as a way to communicate to the git plugin which git features
are not supported by JGit.

  • The reason for not implementing it as a GitCommand implementation is to separate
    the need of a JGitAPIImpl or CliGitAPIImpl to check if a certain additional behaviour
    of git is supported or not.
  • This class can be instantiated with no need of any information, it can be decorated by a
    GitSCMExtension to fill in the features which are not supported.

How to use it in the Git Plugin?

  • Step 1: Define a function within the GitSCMExtension to be implemented by extensions which are not supported by JGit.
    ex: public void determineSupportForJGit(GitSCM scm, UnsupportedCommand unsupportedCommand) { }
  • Step 2: Let's take GitLFSPull as an example, implement a function called:
    public void determineSupportForJGit(GitSCM scm, UnsupportedCommand cmd) {
        List<RemoteConfig> repos = scm.getRepositories();
        cmd.lfsRemote(repos.get(0).getName()); 
}
  • Step 3: Use the collected information to determine if JGit can be supported or not using the UnsupportedCommand only.

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that verify my changes
  • Unit tests pass locally with my changes
  • I have added documentation as necessary
  • No Javadoc warnings were introduced with my changes
  • No spotbugs warnings were introduced with my changes
  • I have interactively tested my changes

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)

@rishabhBudhouliya rishabhBudhouliya changed the title UnsupportedCommand Add a new command: UnsupportedCommand to communicate compatibility of JGit Aug 4, 2020
@rishabhBudhouliya
Copy link
Contributor Author

@MarkEWaite Many thanks for writing the test cases, I was working on the git plugin PRs and couldn't add those in time.

While the automated cases written should be more than enough to cover tests functionality wise, I believe we may have to add more test cases within the git plugin to check if the UnsupportedCommand is able to determine support after being used by various extensions.

@MarkEWaite MarkEWaite added the enhancement Improvement or new feature label Aug 7, 2020
rishabhBudhouliya and others added 3 commits August 7, 2020 08:16
This command serves as a way to communicate the git plugin which git features
are not supported by JGit.
- The reason for not implementing it as a GitCommand implementation is to separate
the need of a JGitAPIImpl or CliGitAPIImpl to check if a certain additional behaviour
of git is supported or not.
- This class can be isntantiated with no need of any information, it can be decorated by a
GitSCMExtension to fill in the features which are not supported.
@MarkEWaite MarkEWaite force-pushed the add-unsupportedCommand branch from 1d27f22 to 40151af Compare August 7, 2020 14:17
@MarkEWaite
Copy link
Contributor

@rishabhBudhouliya I saw that the message associated with the first commit in this pull request was missing the blank line after the first line. That causes the log output of command line git to be "noisy". I modified the commit message to add that blank line so that the log output would be more tidy. I also added javadoc comments for all the public methods of the UnsupportedCommand class so that we don't have javadoc warnings added to the build.

I believe this is ready to merge once the CI job passes.

@MarkEWaite MarkEWaite merged commit c55a7f7 into jenkinsci:master Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants