Skip to content

Git clean with -e without it's parameter and --dry-run right after it, is hot, it runs for real instead of aborting #1812

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

Closed
ghost opened this issue Sep 2, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 2, 2018

Referr to #1811 for other base setup and details information.

git clean -dfe --dry-run
  • What did you expect to occur after running these commands?

Output messages showing what would be done.

  • What actually happened instead?

Output messages showing what was just done.

gfw_issue_cmd_git-clean_hot-dryrun-without-pattenr_2sep2018

@PhilipOakley
Copy link

I'm not sure that the command is correct. The -e option expects a pattern, and it is probably consuming the --dry-run as the pattern rather than as an option. Maybe?. (note that there is a space between the -e and the in the documentation)

Maybe you wanted git clean -dfne so that the dry run option (n) is included inside the stuck short form sequence (though still not sure you needed/wanted the 'e')

@PhilipOakley
Copy link

space between the -e and the <pattern> in the documentation)

(text in angle brackets got lost!)

@ghost
Copy link
Author

ghost commented Sep 3, 2018

@PhilipOakley Sure, it's not suppose to be valid, sorry for not explaining the context in more detail, it's kind of a beginner case here, it probably isn't usual to experienced git users, but I reported what I found.

I just landed on it by accident, I was in a bit of a rush getting things fixed, since -dfX wouldn't give me the correct behavior for my case, i just started using other subcomands. I first tried the -x and then e at the end of -df, I didn't try first without any subcomands, it's it was kinda backwards. I suspect I would have got to the intended clean behavior and wouldn't have got to discovering this issue otherwise, so it's not the -e option that made it work, I later realized.

Indeed it's probably consuming the --dry-run as a pattern, or consuming it but also nulling it completely, who knows what haywire is going on under the hood, the effect it has is pretty much the worst case scenario.

I'm not sure if it's an actual bug, undocumented behavior, but it surely isn't the most optimal behavior, so even if it is the users fault, I'd say a fix is justified because of the consequence it has, actually running things when the user expressly specifies a dry run. If you guys don't agree or it doesn't fall into any of critera just do what you think it's best or whatever policy git has for such cases.

git clean --dry-run -dfe runs properly, it refuses to run, giving out syntax help.

@PhilipOakley
Copy link

@Zexaron Thanks for coming back with the explanation. I hope my answer helped.

There is also a google-groups 'git users' / Git for Humans list which offers some help without the need to log an issue for the developers (though in this case it was a reasonable misunderstanding).

Is it OK to close the issue now? [I've closed it, but you can re-open / reply if needed]

@ghost
Copy link
Author

ghost commented Sep 20, 2018

Yeah, I figured it's something git core has to fix, probably not a GFW problem, stuff like bug reports about git it self go through the mailing list and other ways right ?

@PhilipOakley
Copy link

I figured it's something git core has to fix, probably not a GFW problem, stuff like bug reports about git it self go through the mailing list and other ways right ?

The main git folk will probably say 'works as designed' (which unfortunately it is).

An alternate route is to consider how the manual could be improved, such as a short terse phrase at the right place that would help pull folks up short to notice this potential 'gotcha'. Personally I'm very supportive of more user friendly manuals (as compared to expert friendly).

The main git list is at [email protected] but will reject any email containing HTML - so it is plain text all the way!

The mailing list archives are available at https://public-inbox.org/git/, http://marc.info/?l=git and other archival sites.

@dscho
Copy link
Member

dscho commented Sep 28, 2018

I figured it's something git core has to fix

has to? LOL... While I understand that sentiment, you will find it extremely difficult to assign work to volunteers in this manner ;-) Which will leave you only two options: fix things yourself, or live with the status quo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants