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

git - clean before build does not clean submodules

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • git-plugin
    • None
    • hudson 1.366, git plugin 1.0.1

    Description

      When using a repository containing submodules, if the project is set to clean after the checkout, the git clean -fdx command is issued. However, the clean command will not iterate through submodules, resulting in the submodules still containing private content (debris from past builds.) Would it be possible to get the clean code changed to iterate through the submodules and perform a git clean -fdx within each as well?

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer added a comment -

            Ah, easy fix, I think - pushing change up to master now.

            abayer Andrew Bayer added a comment - Ah, easy fix, I think - pushing change up to master now.
            dogfood dogfood added a comment -

            Integrated in plugins_hudson-git-plugin #22
            JENKINS-7376 Calling git clean in submodules as well now

            Andrew Bayer :
            Files :

            • src/main/java/hudson/plugins/git/GitSCM.java
            dogfood dogfood added a comment - Integrated in plugins_hudson-git-plugin #22 JENKINS-7376 Calling git clean in submodules as well now Andrew Bayer : Files : src/main/java/hudson/plugins/git/GitSCM.java
            rzwierz Rafal Zwierz added a comment -

            This issue has raised its ugly head again. There is one path through checkout function which doesn't clean submodules (even though it does clean the superproject). I have a fix for it and will raise a pull request.

            rzwierz Rafal Zwierz added a comment - This issue has raised its ugly head again. There is one path through checkout function which doesn't clean submodules (even though it does clean the superproject). I have a fix for it and will raise a pull request.

            Code changed in jenkins
            User: Rafal Zwierz
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/abe5ceb1a045655d1df2177347babc5f4f6ff3c7
            Log:
            JENKINS-7376 Clean submodules whenever cleaning superproject (after checkout), unless submodules are disabled

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rafal Zwierz Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/abe5ceb1a045655d1df2177347babc5f4f6ff3c7 Log: JENKINS-7376 Clean submodules whenever cleaning superproject (after checkout), unless submodules are disabled

            Code changed in jenkins
            User: Nicolas De loof
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/cb2e9c911b597b205a78e67f3c7cb624236cf5f3
            Log:
            Merge pull request #105 from rzwierz/master

            Fix for JENKINS-7376

            Compare: https://github.com/jenkinsci/git-plugin/compare/eecf24474587...cb2e9c911b59

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/cb2e9c911b597b205a78e67f3c7cb624236cf5f3 Log: Merge pull request #105 from rzwierz/master Fix for JENKINS-7376 Compare: https://github.com/jenkinsci/git-plugin/compare/eecf24474587...cb2e9c911b59
            stovenator Mark Stover added a comment -

            If a submodule exists for a given branch, but not on other branches, git clean -fdx won't clean up the submodule directory. It requires f to be passed twice.

            Using the clean following clean command will remove git repositories that are not listed as part of a repositories submodules:

            git clean -ffdx

            stovenator Mark Stover added a comment - If a submodule exists for a given branch, but not on other branches, git clean -fdx won't clean up the submodule directory. It requires f to be passed twice. Using the clean following clean command will remove git repositories that are not listed as part of a repositories submodules: git clean -ffdx

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/hudson/plugins/git/extensions/impl/CleanBeforeCheckout.java
            src/main/resources/hudson/plugins/git/extensions/impl/CleanBeforeCheckout/help.html
            src/test/java/hudson/plugins/git/AbstractGitTestCase.java
            src/test/java/hudson/plugins/git/GitSCMTest.java
            http://jenkins-ci.org/commit/git-plugin/743d715f21183e473adae4b4d969f3ccf16d3578
            Log:
            Merge branch 'master' of https://github.com/ds2wang/git-plugin

            [Fixed JENKINS-7376] Clean after checkout cleans submodules
            [Fixed JENKINS-13910] Clean operates on submodules
            [Fixed JENKINS-22510] Clean after checkout causes checkout failure

            Compare: https://github.com/jenkinsci/git-plugin/compare/fd2bc21c8951...743d715f2118

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/extensions/impl/CleanBeforeCheckout.java src/main/resources/hudson/plugins/git/extensions/impl/CleanBeforeCheckout/help.html src/test/java/hudson/plugins/git/AbstractGitTestCase.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/743d715f21183e473adae4b4d969f3ccf16d3578 Log: Merge branch 'master' of https://github.com/ds2wang/git-plugin [Fixed JENKINS-7376] Clean after checkout cleans submodules [Fixed JENKINS-13910] Clean operates on submodules [Fixed JENKINS-22510] Clean after checkout causes checkout failure Compare: https://github.com/jenkinsci/git-plugin/compare/fd2bc21c8951...743d715f2118

            People

              markewaite Mark Waite
              aaron_neerenberg aaron_neerenberg
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: