Summary: | CleanCommand does not clean file in sub-directory | ||
---|---|---|---|
Product: | [Technology] JGit | Reporter: | Rüdiger Herrmann <ruediger.herrmann> |
Component: | JGit | Assignee: | Project Inbox <jgit.core-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | ned.twigg, robin.rosenberg, robin, ruediger.herrmann |
Version: | unspecified | Keywords: | helpwanted |
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Rüdiger Herrmann
2014-03-27 13:07:40 EDT
try setCleanDirectories(true) Maybe the docs needs updating (In reply to Robin Rosenberg from comment #1) > try setCleanDirectories(true) Sorry, I forgot to mention that I tried that already. It doesn't make a difference. I bumped into this too, spent a little time isolating it. Here's one of the problems: - I have a folder `build`, which is ignored - I have a file `build.gradle`, which is untracked If I do a clean, I would expect the untracked `build.gradle` to be deleted, but that does not happen. That is because the code thinks that `build.gradle` is a file inside the `build` folder, because it uses `startsWith` as its check. You could fix this with `startsWith(path + "/")` to fix the bug on this line: https://github.com/eclipse/jgit/blob/0a15cb3a2bc14feec11baa1977567179ce3094bc/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java#L220 But the code has other bugs as well. It seems to be making assumptions about what the output of the StatusCommand is, and I believe those assumptions no longer hold true today. Here is a total re-implementation of the command which we use, it fixes a few bugs and simplifies the code quite a bit. You can easily copy-paste it into your project and use it with stock JGit, no patching necessary https://gist.github.com/nedtwigg/a5ce9dadc160a8ec2ac48deb55b4e4c6 Naturally, we would like to contribute it back upstream, but we'd rather use our limited upstreaming budget to get multiple worktree support merged, which seems to be bogged down in style nits: https://git.eclipse.org/r/#/c/126281/ |