-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-38699] Only check for git repo in current workspace dir
The CliGit implementation of hasGitRepo() has the strange and surprising behavior that if a workspace contains a directory named ".git" and that directory is not a git repository (for example, an empty directory), then command line git will search upwards in the file system tree to find a git repository and will perform its operations on the repository it finds. That is the right behavior for a user running command line git. It allows them to change to different directories and have the same experience with command line git. It is a dangerous behavior when deciding to run `git clean` or other destructive operations in a Jenkins agent workspace. If the agent workspace is damaged, then the git commands search upwards, outside the agent workspace. This change causes the git plugin to only search in the workspace, not any of the parent directories of the workspace. Special thanks to @arpoch for patient work understanding the problem, proposing a solution to the problem, and providing tests that show the problem.
- Loading branch information
1 parent
b90a2a0
commit 583d700
Showing
5 changed files
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters