git-client: add support for --force option to submodule update#200
git-client: add support for --force option to submodule update#200jacob-keller wants to merge 1 commit intojenkinsci:masterfrom
Conversation
|
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
b9bdafd to
1ff4f75
Compare
|
I submitted a new version that has a test case which covers the behavior I need and the expected behavior of --force. it will force a re-checkout even if you already have it checked out. Thus, it will recheckout any files which we deleted. |
|
One alternative to this approach is to add "--force" by default, as this is what we already do inside the git plugin for regular checkouts. It seems weird that we wouldn't also add it for submodules as well. I haven't yet tried this change, and I think it's riskier because it is more invasive than the addition of an option. That being said, if we already know that we want it generally why not also for submodules? Options are only good if they are infact useful being both on and off.. If everyone ends up having to check "yes" why should it be optional in the first place. Thoughts? |
|
Note it may be possible for the same effect to be had by using the clean option, which also (not entirely documented?) performs a git-reset as well. |
|
I am testing, but I think the clean option may actually already do what Ineed so this pull request ist not necessary. I will report back with my results from the clean plugin and see if it is workable instead. |
Also add a test case for --force option Since the supported versions of git do not all support "-C" syntax, extend our cmd(), and launchCommand() syntax with a launchCommandIn() syntax, which we will make use of. This compiled with w.file() allows us to launch a command within a sub directory. Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
1ff4f75 to
ff96fa9
Compare
|
I updated this pull request to include launchCommandIn support, and updated it to use cmdIn() instead, which will help ensure compatibility across platforms of Git. I do believe this functionality is still important, as the clean() extension does not appear to fully fix the issue that --force can. |
The purpose of this is to extend the CLI wrapper to allow --force option which enables recovery from some specific failures when the network has intermittent issues. Particularly, if the submodule update command happens to fail due to network issue, a re-run of the command will not re-checkout the files, as the way git CLI implemenation works it will see that the submodule is already at the desired commit. The Git mailing list said the best way to handle this is to use --force, but I don't think it should be default behavior considering that behavior change which can result.
Signed-off-by: Jacob Keller jacob.keller@gmail.com