This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Remove empty dirs when cleaning with Dir opt.#933
Merged
mcuadros merged 2 commits intosrc-d:masterfrom Aug 29, 2018
kuba--:fix-895/clean-dir
Merged
Remove empty dirs when cleaning with Dir opt.#933mcuadros merged 2 commits intosrc-d:masterfrom kuba--:fix-895/clean-dir
mcuadros merged 2 commits intosrc-d:masterfrom
kuba--:fix-895/clean-dir
Conversation
Contributor
Author
|
@onodera-punpun - Could you check if this fix works for you? |
Contributor
Contributor
Author
|
@ajnavarro - done. I've added a test to check if empty dirs are cleaned, as well. |
ajnavarro
approved these changes
Aug 27, 2018
jfontan
approved these changes
Aug 27, 2018
mcuadros
suggested changes
Aug 29, 2018
worktree.go
Outdated
| // skip the path. | ||
| if relativePath != filepath.Base(relativePath) && !opts.Dir { | ||
| continue | ||
| var clean func(string, []os.FileInfo) error |
Contributor
There was a problem hiding this comment.
can you move this function to a member function called doClean
mcuadros
reviewed
Aug 29, 2018
worktree.go
Outdated
| if status.Worktree == Untracked { | ||
| absPath := filepath.Join(w.Filesystem.Root(), relativePath) | ||
| if err := os.Remove(absPath); err != nil { | ||
| if opts.Dir { |
Contributor
There was a problem hiding this comment.
also will be nice move this code to a function something like doCleanDirectories
added 2 commits
August 29, 2018 14:38
Signed-off-by: kuba-- <kuba@sourced.tech>
Signed-off-by: kuba-- <kuba@sourced.tech>
Contributor
Author
|
@mcuadros - PR refined and rebased. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: kuba-- kuba@sourced.tech
Fixes #895
When
CleanOptions.Diris set ontruethen an empty dir (with subdirs) could be removed (this is whatgit clean -f -d .does).