Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25444

CliGit implementation of fetch/deleteBranch does remove open changes, JGit does not

    Details

    • Similar Issues:

      Description

      Git plugin calls fetch with branch always with deleteBranchIfExists, which in case of CliGit results in the call of

      launchCommand("checkout", "-f", ref);
      

      which in turn throws away all local modifications and leaves a clean status.

      in JGit, setForce() is also used, but does not seem to work as expected. There are already comments in the code discussing this behviour, but they only point to checkout conflicts.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          Thanks for detecting that inconsistency. I think the CliGit implementation should be considered the reference implementation and the JGit implementation should eventually be modified to match the behavior of CliGit.

          Show
          markewaite Mark Waite added a comment - Thanks for detecting that inconsistency. I think the CliGit implementation should be considered the reference implementation and the JGit implementation should eventually be modified to match the behavior of CliGit.
          Hide
          paux Stephan Pauxberger added a comment -

          Created pull request 153

          Show
          paux Stephan Pauxberger added a comment - Created pull request 153
          Hide
          paux Stephan Pauxberger added a comment -

          Just for the sake of completeness:

          JGit.CheckoutCommand.setForce() is not equivalent to CLI "checkout -f" but "checkout -B", i.e. to force the resetting of a branch.

          Show
          paux Stephan Pauxberger added a comment - Just for the sake of completeness: JGit.CheckoutCommand.setForce() is not equivalent to CLI "checkout -f" but "checkout -B", i.e. to force the resetting of a branch.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Stephan Pauxberger
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
          http://jenkins-ci.org/commit/git-client-plugin/b96e07e74679e5752a533a089cd46b1876d7ea46
          Log:
          JENKINS-25444 CliGit implementation of fetch/deleteBranch does remove
          open changes, JGit does not

          Created testcase, perform a reset --hard in case of ref checkout an
          branch with delete checkout to simulate CLI behaviour.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephan Pauxberger Path: src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java http://jenkins-ci.org/commit/git-client-plugin/b96e07e74679e5752a533a089cd46b1876d7ea46 Log: JENKINS-25444 CliGit implementation of fetch/deleteBranch does remove open changes, JGit does not Created testcase, perform a reset --hard in case of ref checkout an branch with delete checkout to simulate CLI behaviour.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Stephan Pauxberger
          Path:
          src/main/java/hudson/plugins/git/Branch.java
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          src/main/java/org/jenkinsci/plugins/gitclient/CloneCommand.java
          src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
          http://jenkins-ci.org/commit/git-client-plugin/b8725a5e79d79ad9248c631697f6c6a1beecff41
          Log:
          Merge remote-tracking branch 'upstream/master' into
          JENKINS-25444-fetch-clean

          Conflicts:
          src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephan Pauxberger Path: src/main/java/hudson/plugins/git/Branch.java src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java src/main/java/org/jenkinsci/plugins/gitclient/CloneCommand.java src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java http://jenkins-ci.org/commit/git-client-plugin/b8725a5e79d79ad9248c631697f6c6a1beecff41 Log: Merge remote-tracking branch 'upstream/master' into JENKINS-25444 -fetch-clean Conflicts: src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
          http://jenkins-ci.org/commit/git-client-plugin/88ca6b449dd155a03d7142c9ad5f17fd7ca2b34e
          Log:
          Merge pull request #153 from pauxus/JENKINS-25444-fetch-clean

          JENKINS-25444 CliGit implementation of fetch/deleteBranch does remove

          Compare: https://github.com/jenkinsci/git-client-plugin/compare/797f600d44bf...88ca6b449dd1

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java http://jenkins-ci.org/commit/git-client-plugin/88ca6b449dd155a03d7142c9ad5f17fd7ca2b34e Log: Merge pull request #153 from pauxus/ JENKINS-25444 -fetch-clean JENKINS-25444 CliGit implementation of fetch/deleteBranch does remove Compare: https://github.com/jenkinsci/git-client-plugin/compare/797f600d44bf...88ca6b449dd1
          Hide
          markewaite Mark Waite added a comment -

          Fixed in git-client-plugin 1.11.1 released 7 Nov 2014

          Show
          markewaite Mark Waite added a comment - Fixed in git-client-plugin 1.11.1 released 7 Nov 2014

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              paux Stephan Pauxberger
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: