slawekjaranowski opened a new issue, #1468:
URL: https://github.com/apache/maven-scm/issues/1468

   ### Affected version
   
   2.2.1
   
   ### Bug description
   
   `JGitStatusCommand.getFileStati` only reads the index-related sets of the 
JGit `Status`:
   
   ```java
   addAsScmFiles(all, status.getAdded(), ScmFileStatus.ADDED);
   addAsScmFiles(all, status.getChanged(), ScmFileStatus.UPDATED);
   addAsScmFiles(all, status.getConflicting(), ScmFileStatus.CONFLICT);
   addAsScmFiles(all, status.getModified(), ScmFileStatus.MODIFIED);
   addAsScmFiles(all, status.getRemoved(), ScmFileStatus.DELETED);
   ```
   
   `status.getUntracked()` and `status.getMissing()` are never read, so with 
the JGit provider:
   
   - a new file that is neither tracked nor ignored is not reported;
   - a tracked file deleted on disk without `git rm` is not reported.
   
   As a result, `scm:check-local-modification` and `release:prepare` pass on a 
working copy with such changes.
   
   The gitexe provider already reports a file deleted on disk as `DELETED` (` 
D` in `git status --porcelain`). With #1412 it will also report untracked files 
as `UNKNOWN` (#1170). The two Git providers then return different results for 
the same working copy.
   
   **Reproduction** (git repository with tracked `a.txt`, JGit provider, 
`scm:jgit:` URL):
   
   1. `rm a.txt` (no `git rm`) → `check-local-modification` passes;
   2. `git checkout a.txt && touch new.txt` → `check-local-modification` passes.
   
   **Expected:** both runs fail, as they would with gitexe once #1412 is merged.
   
   **Suggested fix:** add `status.getMissing()` as `DELETED` and 
`status.getUntracked()` as `UNKNOWN`, matching gitexe. JGit lists untracked 
files individually (folders are in a separate `getUntrackedFolders()`), so the 
untracked-directory special case from #1412 is not needed here. The file-set 
filter added in #1370 then applies to these entries as well. With `includes` 
set, a missing file is still dropped by that list-based filter (#1459).
   
   Only `JGitScmProvider.getStatusCommand()` uses `JGitStatusCommand`, so 
check-in is not affected. The same release-notes caveat as in #1412 applies: 
`release:prepare` with JGit will start failing on untracked, non-ignored files.
   
   Related: #1170, #1412, #1459, #1461, #1467 (TCK coverage, which would catch 
this drift between providers).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to