[JIRA] [git] (JENKINS-22510) Clean After Checkout Results in Failed to Checkout Revision

252 views
Skip to first unread message

ray.sennewald@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:20:06 PM4/4/14
to jenkinsc...@googlegroups.com
Issue Type: Bug Bug
Assignee: Nicolas De Loof
Components: git
Created: 05/Apr/14 12:20 AM
Description:

We're executing a job, and trying to perform a git clean. One of our submodules is dirty, and unfortunately since the Jenkins GIT plugin cleans after checkout, we get the following error:

FATAL: Command "git submodule update --init --recursive" returned status code 1:
stdout:
stderr: error: Your local changes to the following files would be overwritten by checkout:
minified/sidecar.js
minified/sidecar.lite.js
minified/sidecar.lite.min.js
minified/sidecar.min.js
Please, commit your changes or stash them before you can switch branches.
Aborting
Unable to checkout 'd58c3304230e4bf26ffb3fa6986d4b6ba90d4c66' in submodule path 'sugarcrm/sidecar'

I tested using the Pre-SCM Buildstep plugin and performing a git clean before the checkout fixes the problem.

Project: Jenkins
Priority: Major Major
Reporter: Ray Sennewald
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

ray.sennewald@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:22:04 PM4/4/14
to jenkinsc...@googlegroups.com

David Wang has implemented functionality to Clean Before Checkout, which actually helps fix this scenario. His pull request is here: https://github.com/jenkinsci/git-plugin/pull/220.

ray.sennewald@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:26:04 PM4/4/14
to jenkinsc...@googlegroups.com
Change By: Ray Sennewald (05/Apr/14 12:24 AM)
Description:
We're executing a job, and trying to perform a git clean.  One of our submodules is dirty, and unfortunately since the Jenkins GIT plugin cleans after checkout, we get the following error:

FATAL: Command "git submodule update --init --recursive" returned status code 1:
stdout: 
stderr: error: Your local changes to the following files would be overwritten by checkout:
minified/sidecar.js
minified/sidecar.lite.js
minified/sidecar.lite.min.js
minified/sidecar.min.js
Please, commit your changes or stash them before you can switch branches.
Aborting
Unable to checkout 'd58c3304230e4bf26ffb3fa6986d4b6ba90d4c66' in submodule path 'sugarcrm/sidecar'

I tested using the Pre-SCM Buildstep plugin and performing a git clean before the checkout fixes the problem.   Specifically having it perform: 
git submodule foreach --recursive git clean -fdx
git submodule foreach --recursive git reset --hard

before we do the checkout fixes it.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:44:04 PM4/4/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-22510

Considering the number of cases related to this topic over the course of the evolution of the git plugin, I'd very much prefer that we have a very deep set of tests created which will assure that submodules behave as desired. Some of the related bugs (JENKINS-8315, JENKINS-7445) are listed as fixed, yet those fixes either did not survive, or do not meet your need. I'd really like more tests that express the failure cases, since the git-client-plugin has very few submodule tests.

Ultimately, we may need a "clean before checkout" operation, but it seems like we should first invest effort to create unit tests which will assure that submodules are behaving as expected in the git client plugin (and possibly in the git plugin).

Relying on the user to know when they should select "clean before checkout" and when they should "clean after checkout" seems like we're expecting too much from the users. I would very much prefer to find a sequence which avoids requiring the addition of yet another form of clean. We have "wipe workspace" which removes everything, we have "clean after checkout", and this will add "clean before checkout".

Since you and David are active users of submodules, would you be willing to provide one or more test cases which illustrate this failure mode, then use that test case to evaluate alternatives to fix the test?

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:49:05 PM4/4/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

Considering the number of cases related to this topic over the course of the evolution of the git plugin, I'd very much prefer that we have a very deep set of tests created which will assure that submodules behave as desired. Some of the related bugs (JENKINS-8315, JENKINS-7445) are listed as fixed, yet those fixes either did not survive, or do not meet your need. I'd really like more tests that express the failure cases, since the git-client-plugin has very few submodule tests.

Ultimately, we may need a "clean before checkout" operation, but it seems like we should first invest effort to create unit tests which will assure that submodules are behaving as expected in the git client plugin (and possibly in the git plugin).

Relying on the user to know when they should select "clean before checkout" and when they should "clean after checkout" seems like we're expecting too much from the users. I would very much prefer to find a sequence which avoids requiring the addition of yet another form of clean. We have "wipe workspace" which removes everything, we have "clean after checkout", and this will add "clean before checkout".

Since you and David are active users of submodules, would you be willing to provide one or more test cases which illustrate this failure mode, then use that test case to evaluate alternatives to fix the test?

As an example of an alternative, would the "git clean -ffxd" command (double f arguments clean untracked directories managed by another repository) resolve the issue without requiring the addition of a new command?

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 4, 2014, 8:49:04 PM4/4/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

Considering the number of cases related to this topic over the course of the evolution of the git plugin, I'd very much prefer that we have a very deep set of tests created which will assure that submodules behave as desired. Some of the related bugs (JENKINS-8315, JENKINS-7445) are listed as fixed, yet those fixes either did not survive, or do not meet your need. I'd really like more tests that express the failure cases, since the git-client-plugin has very few submodule tests.

Ultimately, we may need a "clean before checkout" operation, but it seems like we should first invest effort to create unit tests which will assure that submodules are behaving as expected in the git client plugin (and possibly in the git plugin).

Relying on the user to know when they should select "clean before checkout" and when they should "clean after checkout" seems like we're expecting too much from the users. I would very much prefer to find a sequence which avoids requiring the addition of yet another form of clean. We have "wipe workspace" which removes everything, we have "clean after checkout", and this will add "clean before checkout".

Since you and David are active users of submodules, would you be willing to provide one or more test cases which illustrate this failure mode, then use that test case to evaluate alternatives to fix the test?

As an example of an alternative, would the "git clean -ffxd" command (double f arguments clean untracked directories managed by another repository) resolve the issue without requiring the addition of a new command

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 9:50:04 AM4/6/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 9:55:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again

git checkout master
ls modules/ntp # reports an error, no content in modules/ntp

Create a branch containing a conflicting file

git checkout -b tests/notSubmodules
mkdir -p modules/ntp
echo "This is not a contribution" >> modules/ntp/CONTRIBUTING.md

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:00:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Create a branch containing a conflicting file

git checkout -b tests/notSubmodules
mkdir -p modules/ntp
echo "This is not a contribution" >> modules/ntp/CONTRIBUTING.md

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:09:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch containing a conflicting file - fails

git checkout tests/notSubmodules # fails - untracked files would be overwritten

Unfortunately, I've not yet found a sequence of "clean" and "checkout" commands which will allow me to switch from tests/getSubmodules to tests/notSubmodules.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:23:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch containing a conflicting file - fails

git checkout tests/notSubmodules # fails - untracked files would be overwritten

Unfortunately, I've not yet found a sequence of "clean" and "checkout" commands which will allow me to switch from tests/getSubmodules to tests/notSubmodules.

In that repository, the branch to branch transitions seem behave like this:

Current Branch Branch to Checkout Result
master tests/getSubmodules ok
master tests/notSubmodules ok
tests/getSubmodules master ok
tests/notSubmodules master ok
tests/getSubmodules tests/notSubmodules fails
tests/notSubmodules tests/getSubmodules fails

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:26:06 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:41:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch (force) containing a conflicting file - works

git checkout -f tests/notSubmodules # works - but warns unable to rmdir
git clean -xffd
ls modules/ntp # one file in modules/ntp as expected

Checkout tests/getSubmodules (force) - fails

git checkout -f tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # one file in modules/ntp - should be more files there

The working sequence in my case seems to be "force checkout, then use git clean -xffd". That doesn't work for the transition from "getSubmodules" to "notSubmodules", but covers the other cases. Even a clean before checkout does not work for the transition from "getSubmodules" to "notSubmodules" (as far as I can tell). However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

In that repository, the branch to branch transitions seem to behave like this:

Current Branch Branch to Checkout Result
master tests/getSubmodules ok
master tests/notSubmodules ok
tests/getSubmodules master ok
tests/notSubmodules master ok
tests/getSubmodules tests/notSubmodules fails
tests/notSubmodules tests/getSubmodules ok

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:50:07 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch (force) containing a conflicting file - works

git checkout -f tests/notSubmodules # works - but warns unable to rmdir
git clean -xffd
ls modules/ntp # one file in modules/ntp as expected

Checkout tests/getSubmodules (force) - fails

git checkout -f tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # one file in modules/ntp - should be more files there

The working sequence in my case seems to be "force checkout, then use git clean -xffd". That doesn't work for the transition from "getSubmodules" to "notSubmodules", but covers the other cases. Even a clean before checkout does not work for the transition from "getSubmodules" to "notSubmodules" (as far as I can tell). However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

In that repository, the branch to branch transitions seem to behave like this:

Current Branch Branch to Checkout Result
Command
master tests/getSubmodules ok git checkout -f tests/getSubmodules ; git clean -xffd ; git status
master tests/notSubmodules ok git checkout -f tests/notSubmodules ; git clean -xffd ; git status
tests/getSubmodules master ok git checkout -f master ; git clean -xffd ; git status
tests/notSubmodules master ok git checkout -f master ; git clean -xffd ; git status
tests/getSubmodules tests/notSubmodules fails git checkout -f tests/notSubmodules ; git clean -xffd ; git status
tests/notSubmodules tests/getSubmodules ok git checkout -f tests/getSubmodules ; git clean -xffd ; git status

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:52:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch (force) containing a conflicting file - works

git checkout -f tests/notSubmodules # works - but warns unable to rmdir
git clean -xffd
ls modules/ntp # one file in modules/ntp as expected

Checkout tests/getSubmodules (force) - fails

git checkout -f tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # one file in modules/ntp - should be more files there

The working sequence in my case seems to be "force checkout, then use git clean -xffd". However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

tests/notSubmodules tests/getSubmodules ok git checkout -f tests/getSubmodules ; git clean -xffd ; git status

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:56:04 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch (force) containing a conflicting file - works

git checkout -f tests/notSubmodules # works - but warns unable to rmdir
git clean -xffd
ls modules/ntp # one file in modules/ntp as expected

Checkout tests/getSubmodules (force) - works

git checkout -f tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # one file in modules/ntp - should be more files there

The working sequence in my case seems to be "force checkout, then use git clean -xffd". However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

In that repository, the branch to branch transitions seem to behave like this:

Current Branch Branch to Checkout Result Command
master tests/getSubmodules ok git checkout -f tests/getSubmodules ; git submodule update --init --recursive ; git clean -xffd ; git status
master tests/notSubmodules ok git checkout -f tests/notSubmodules ; git clean -xffd ; git status
tests/getSubmodules master ok git checkout -f master ; git clean -xffd ; git status
tests/notSubmodules master ok git checkout -f master ; git clean -xffd ; git status
tests/getSubmodules tests/notSubmodules ok git checkout -f tests/notSubmodules ; git clean -xffd ; git status
tests/notSubmodules tests/getSubmodules ok git checkout -f tests/getSubmodules ; git submodule update --init --recursive ; git clean -xffd ; git status

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 10:59:06 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/getSubmodules - works

git checkout tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # Shows there is content in modules/ntp

Checkout master again - works

git checkout master # warns there are untracked files in modules directory
ls modules/ntp # shows content in modules/ntp is still there

git clean -xfd # skips modules/ntp and modules/firewall
ls modules/ntp # shows content in modules/ntp is still there

git clean -xffd # deletes modules/ntp and modules/firewall
ls modules/ntp # no content in modules/ntp

Checkout branch containing a conflicting file - works

git checkout tests/notSubmodules
ls modules/ntp # one file in modules/ntp

Checkout tests/getSubmodules again - works

git checkout tests/getSubmodules
git submodule update --init --recursive

Checkout branch (force) containing a conflicting file - works

git checkout -f tests/notSubmodules # works - but warns unable to rmdir
git clean -xffd
ls modules/ntp # one file in modules/ntp as expected

Checkout tests/getSubmodules (force) - fails

git checkout -f tests/getSubmodules
git submodule update --init --recursive
ls modules/ntp # one file in modules/ntp - should be more files there
tests/notSubmodules tests/getSubmodules fails
git checkout -f tests/getSubmodules ; git submodule update --init --recursive ; git clean -xffd ; git status

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 11:19:06 AM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

The failing sequence I see currently is:

  • checkout master
  • checkout tests/notSubmodules
  • checkout tests/getSubmodules
  • checkout tests/notSubmodules

I defined a bash shell function "checkout" for my testing convenience. It is

checkout ()
{
    branch=$1;
    git checkout -f $branch;
    git clean -xffd;
    git submodule update --init --recursive;
    git status
}

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/notSubmodules - works

checkout tests/notSubmodules

Checkout tests/getSubmodules - works

checkout tests/getSubmodules

Checkout tests/notSubmodules - works

checkout tests/notSubmodules

Checkout tests/getSubmodules - fails

checkout tests/getSubmodules

The "mostly" working sequence in my case seems to be "force checkout, git clean -xffd, submodule update". That seems to work for all the cases I've tested except the master to not to get to not to get case. However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 6:40:06 PM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state, and haven't yet understood them. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

The failing sequence I see currently is:

  • checkout master - ok
  • checkout tests/notSubmodules - ok
  • checkout tests/getSubmodules - ok
  • checkout tests/notSubmodules - fails

I defined a bash shell function "checkout" for my testing convenience. It is

checkout ()
{
    branch=$1;
    git checkout -f $branch;
    git clean -xffd;
    git submodule update --init --recursive;
    git status
}

Clone the repository - works

git clone git://github.com/MarkEWaite/git-client-plugin
cd git-client-plugin
ls modules/ntp # reports an error, no content in modules/ntp

Checkout tests/notSubmodules - works

checkout tests/notSubmodules

Checkout tests/getSubmodules - works

checkout tests/getSubmodules

Checkout tests/notSubmodules - works

checkout tests/notSubmodules

Checkout tests/getSubmodules - fails

checkout tests/getSubmodules

The "mostly" working sequence in my case seems to be "force checkout, git clean -xffd, submodule update". That seems to work for all the cases I've tested except the master to notSubmodules to getSubmodules to notSubmodules to getSubmodules case. However, since my case does not duplicate your message, I'm not sure if you'll see the same behavior as I see.

In that repository, the branch to branch transitions seem to behave like this:

Current Branch Branch to Checkout Result
master tests/getSubmodules ok
master tests/notSubmodules ok
tests/getSubmodules master ok
tests/notSubmodules master ok
tests/getSubmodules tests/notSubmodules fails in some cases
tests/notSubmodules tests/getSubmodules fails in some cases

However, the failure message I'm seeing is not the same as the failure message you're seeing. I'm confident that means I don't understand enough about submodules. Can you provide a similar series of steps (preferably using a fork of the git-client-plugin repository) to show your case?

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 6, 2014, 8:44:04 PM4/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state described in the bug report, and haven't yet understood how to do that. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

This message is automatically generated by JIRA.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 7, 2014, 12:13:04 AM4/7/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-22510

I've been trying to understand the sequence of git operations which arrive at that state described in the bug report, and haven't yet understood how to do that. My attempts have persuaded me that I don't understand submodules. I used my fork of the git-client-plugin for my experiments.

If you're interested in my first attempt to express that failure mode as a unit test, refer to the proto-submodule-tests branch in my fork of the git-client-plugin source. The test is "not yet ready for prime time".

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 9, 2014, 2:51:05 PM4/9/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-22510

I think git.clean() can't be switched method to always use "clean -xffd" instead of "clean -xfd" because that may damage existing use cases which depend on the current behavior.

I haven't been able to find any better solution than the solution you've proposed. I agree with your recommendation that we should add "Clean before checkout" as an additional behavior. We'll rely on users to choose which ever of the two best meets the need of their use case.

I think we'll still need the switch branch of submodule before checkout pull request as well, but I think that "Clean before checkout" is also a needed addition to the git plugin.

Over the course of the next week, I'll perform some additional tests to better understand the impact of the change.

ray.sennewald@gmail.com (JIRA)

unread,
Apr 9, 2014, 6:14:04 PM4/9/14
to jenkinsc...@googlegroups.com

Mark, I appreciate your willingness to help us out here. TBH, I don't feel that my situation is unique to submodules. It appears to me that the problem would arise anytime that you have a conflict of a file between what you have in your working copy, and what your trying to checkout. I'd love to be able to add some tests around this, but have been quite busy at work in other regards lately. My 2 cents are, do we really need clean after checkout? Is there any situation that this behavior is needed, that can't be taken care of by doing a clean before checkout? Perhaps we should change Clean After Checkout to be called Clean Before Checkout, and change its behavior to do what we implemented in clean before checkout? What do you think? I'm more than happy to have David or I help out here.

ray.sennewald@gmail.com (JIRA)

unread,
Apr 9, 2014, 6:29:04 PM4/9/14
to jenkinsc...@googlegroups.com
 
Ray Sennewald edited a comment on Bug JENKINS-22510

Mark, I appreciate your willingness to help us out here. TBH, I don't feel that my situation is unique to submodules. It appears to me that the problem would arise anytime that you have a conflict of a file between what you have in your working copy, and what your trying to checkout. I'd love to be able to add some tests around this, but have been quite busy at work in other regards lately. My 2 cents are, do we really need clean after checkout? Is there any situation that this behavior is needed, that can't be taken care of by doing a clean before checkout? Perhaps we should change Clean After Checkout to be called Clean Before Checkout, and change its behavior to do what we implemented in clean before checkout? What do you think? I'm more than happy to have David or I help out here.

I should mention, what worked for us was the correct order of operations. We didn't need a git clean -ffdx, we just needed git clean -fdx and git reset --hard to be executed on all submodules BEFORE we do a checkout on those submodules.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 9, 2014, 7:38:04 PM4/9/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-22510

I'm somewhat fanatical about backward compatibility, and removing "Clean after checkout" (or mutating it to be "Clean before checkout") would risk all sorts of compatibility problems. The git plugin (and the git client plugin) are two of the most used Jenkins plugins. Many users depend on them to remain compatible from one version to the next, and to retain their old behavior (no matter how odd that behavior may appear).

I'm glad the "git clean -fdx" was sufficient, since that retains compatibility with the existing code and existing job definitions.

scm_issue_link@java.net (JIRA)

unread,
Apr 9, 2014, 11:57:09 PM4/9/14
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: David S Wang
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/fb12fed4c1c8af11db68ec236961401d3d11eb7b
Log:
Files/changes added to allow clean before checkout resolving JENKINS-22510

scm_issue_link@java.net (JIRA)

unread,
Apr 9, 2014, 11:57:10 PM4/9/14
to jenkinsc...@googlegroups.com

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

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 10, 2014, 12:03:05 AM4/10/14
to jenkinsc...@googlegroups.com
Mark Waite resolved Bug JENKINS-22510 as Fixed

Fix will be available in next release after git plugin 2.2.0

Change By: Mark Waite (10/Apr/14 4:02 AM)
Status: Open Resolved
Resolution: Fixed

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 10, 2014, 12:03:05 AM4/10/14
to jenkinsc...@googlegroups.com
Mark Waite closed Bug JENKINS-22510 as Fixed
Change By: Mark Waite (10/Apr/14 4:02 AM)
Status: Resolved Closed
Reply all
Reply to author
Forward
0 new messages