jenkinsci / jenkinsci/git-client-plugin

[JENKINS-55875] Submodule update fails when the submodule isn't clean

Open
#1,591 2 comments 0 reactions 0 assignees View on GitHub
component:git-client-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
152
Forks
402
Avg merge
6h 47m
Merged PRs (30d)
4

Description

Jenkins doesn't forcibly update submodules. This means that a checkout can fail with:

hudson.plugins.git.GitException: Command "git submodule update --init --recursive modules/gmock" returned status code 1:

stdout:
stderr: error: Your local changes to the following files would be overwritten by checkout:
build-aux/config.guess
build-aux/config.sub
gtest/build-aux/config.guess
gtest/build-aux/config.sub
Please, commit your changes or stash them before you can switch branches.
Aborting
Unable to checkout 'ec44c6c1675c25b9827aacd08c02433cccde7780' in submodule path 'modules/gmock'

Note, while JENKINS-22510">JENKINS-22510 is relevant, and cleaning the checkout before checking out would resolve the problem, that's not a viable solution. Cleaning the checkout throws away all built files, which means the build is no longer incremental.

Note, this means the behaviour for submodules doesn't match it's behaviour for the standard checkout (which is checked out with --force).

---
Originally reported by richardwhiuk, imported from: Submodule update fails when the submodule isn't clean


  • assignee: richardwhiuk
  • status: Open
  • priority: Minor
  • component(s): git-client-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 2
  • imported: 20251211-071809

Raw content of original issue

Jenkins doesn't forcibly update submodules. This means that a checkout can fail with:



hudson.plugins.git.GitException: Command "git submodule update --init --recursive modules/gmock" returned status code 1:

stdout:
stderr: error: Your local changes to the following files would be overwritten by checkout:
build-aux/config.guess
build-aux/config.sub
gtest/build-aux/config.guess
gtest/build-aux/config.sub
Please, commit your changes or stash them before you can switch branches.
Aborting
Unable to checkout 'ec44c6c1675c25b9827aacd08c02433cccde7780' in submodule path 'modules/gmock'


Note, while JENKINS-22510 is relevant, and cleaning the checkout before checking out would resolve the problem, that's not a viable solution. Cleaning the checkout throws away all built files, which means the build is no longer incremental.

Note, this means the behaviour for submodules doesn't match it's behaviour for the standard checkout (which is checked out with --force).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.