New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean working directory skip paths #11102
Clean working directory skip paths #11102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks OK, no deep review, not run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the more meaningful --exclude option string
// 3. Replace whitespace with '?' and convert to POSIX path | ||
// 3. join together with space as separator | ||
|
||
return string.Join(" ", textBoxExcludePaths.Lines.Where(a => !string.IsNullOrEmpty(a)).Select(a => string.Format("-e {0}", a.Replace(" ", "?")).ToPosixPath())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the more meaningful --exclude
(short option format should be used only by humans when typing the command from command line)
I also would have preferred a better letter than 'a'. 'p' for 'path'?
And maybe use string interpolation instead of string.Format()?
{ | ||
return null; | ||
} | ||
|
||
// 1. get all lines from text box which are not empty | ||
// 2. wrap lines with "" | ||
// 3. join together with space as separator | ||
return string.Join(" ", textBoxPaths.Lines.Where(a => !string.IsNullOrEmpty(a)).Select(a => string.Format("\"{0}\"", a))); | ||
return string.Join(" ", textBoxIncludePaths.Lines.Where(a => !string.IsNullOrEmpty(a)).Select(a => string.Format("\"{0}\"", a))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have preferred a better letter than 'a'. 'p' for 'path'?
And maybe use string interpolation instead of string.Format()?
Should we convert to posix path here also?
Could you rebase and resolve the conflicts, please?
|
} | ||
|
||
// 1. get all lines from text box which are not empty | ||
// 2. Prepend lines with '-e ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 2. Prepend lines with '-e ' | |
// 2. Prepend lines with '--exclude ' |
Same for tests -e there too.
I also would prefer to move this to GitCommandHelpers.cs, just providing the string or an array (if checkbox set).
(This would affect tests too.)
But I leave this to another maintainer to request, I can live with this.
Judging by the number of commits it doesn't look like you managed to cleanly rebase your work. E.g., there are unrelated commits: Please perform a clean rebase of your work on top of the latest master. https://github.com/gitextensions/gitextensions/wiki/How-To%3A-Squash-and-Rebase-your-changes#rebase may be of some help. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase
Apologies for the mix up, still figuring out the git workflow. Please let me know if this is looking correct. |
It is not fixed. Rebase preserving commits is not straight forward as there are intermediate conflicts. In this case, it is easiest to squash on the BASE (soft reset), commit with proper message and then rebase on master. There are quite some commits here, I do not think they add value in a further review (review has basically to be restarted, in this case it is OK). |
Would you mind taking a look at this temp branch I made? I'd like to make sure I'm doing this right before I start overwriting things here. To get this PR's branch to the same state I should just need to force push then do a simple rebase for the latest changes. |
Fine, except that GitCommandHelpersTest.cs still has -e instead of --exclude |
3a9c2a8
to
c18c621
Compare
c18c621
to
172e5fd
Compare
Appreciate the assistance! |
@scottsumrall thank you. @gerhardol please merge, if all your feedback is addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, have not run
string cmdOutput = FormProcess.ReadDialog(this, arguments: cleanUpCmd, Module.WorkingDir, input: null, useDialogSettings: true); | ||
PreviewOutput.Text = EnvUtils.ReplaceLinuxNewLinesDependingOnPlatform(cmdOutput); | ||
|
||
if (CleanSubmodules.Checked) | ||
{ | ||
var cleanSubmodulesCmd = GitCommandHelpers.CleanSubmodules(mode, dryRun: true, directories: RemoveDirectories.Checked, paths: pathArgument); | ||
var cleanSubmodulesCmd = GitCommandHelpers.CleanSubmodules(mode, dryRun: true, directories: RemoveDirectories.Checked, paths: includePathArgument); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Should we apply excludePathArguments
for submodules, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two viewpoints:
- Paths are relative the superproject and only should be relative the master. Hard to implement though, if wildcards are to be allowed.
- apply the same as for the superproject, similar to include paths. Easier to implement, maybe not expected?
Probably second option.
@scottsumrall thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I completely follow. As of right now, the excludes for the general clean are only for excluding individual files and do not support wildcards. I assume it would be the same for submodules? If we want this feature included I would lean towards the first solution but the second option seems fine for its current state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first option would affect the include files too. But that wasrecently added without consideration.
However, I do not find it reasonable.
Use second alternative, in this PR before merge.
Add exclude paths to CleanSubmodules()
(Make sure there is a test as well, also for include not tested at all now)
I pushed some commits, the merge was bad and preview removed files. |
@scottsumrall Please acknowledge the changes and I will merge |
Looks good to me |
@gerhardol Should I just open a new PR with the changes we discussed or should I create a new issue? |
A new PR only is enough. PR not needed regardless - not big enough to track in my opinion, still reasonable to make this change 'complete'. |
Fixes #11099
Proposed changes
Screenshots
Before
After
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.