jenkinsci / jenkinsci/git-plugin

[JENKINS-28529] Git polling deletes files in workspace if "clean" and "ignore commits in path" are both enabled

Open
#2,660 5 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Sample GIT repo with the following content:


  • ./dir1/file1

  • ./dir1/file3

  • ./dir2/file2

  • ./file1

  • ./file2

When using the following GIT client configuration


  • Clean before checkout

  • Polling ignores commits in certain paths

    • Included: dir1\/.*

    • Excluded:



  • Sparse checkout paths (this is optional; issue is triggered without as well)

    • Path: dir1



the GIT client plugin resets the workspace when polling for changes, i.e. removes any files not part of the repository outside regular job runs. This is rather disturbing if one wants to check the workspace after a build for whatever reason and cannot find files created by the previous build anymore because the periodic polling deleted them in the meantime.

---
Originally reported by rschuetz, imported from: Git polling deletes files in workspace if "clean" and "ignore commits in path" are both enabled


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 5
  • watchers: 10
  • imported: 2025-12-02

Raw content of original issue

Sample GIT repo with the following content:


  • ./dir1/file1

  • ./dir1/file3

  • ./dir2/file2

  • ./file1

  • ./file2

When using the following GIT client configuration


  • Clean before checkout

  • Polling ignores commits in certain paths

    • Included: dir1\/.*

    • Excluded: <empty>



  • Sparse checkout paths (this is optional; issue is triggered without as well)

    • Path: dir1



the GIT client plugin resets the workspace when polling for changes, i.e. removes any files not part of the repository outside regular job runs. This is rather disturbing if one wants to check the workspace after a build for whatever reason and cannot find files created by the previous build anymore because the periodic polling deleted them in the meantime.

environment

```
Jenkins ver. 1.596,

git-plugin 2.3.5,

git-client-plugin 1.16.1
```

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.