progit / progit2

Pro Git 2nd Edition
Other
5.77k stars 1.9k forks source link

Add '--nofork' flag to vim example in Appendix C #1700

Closed ed-flanagan closed 3 years ago

ed-flanagan commented 3 years ago

Changes

The -f/--nofork flag is suggested to be used "... when Vim is executed by a program that will wait for the edit session to finish...." However, this flag is only used when Vim has the GUI version, effectively no-op'ing when non-GUI Vim. This mirrors the existing "--nofork" flag for the Windows gvim example.

Context

I didn't see any prior issues/PRs related to this flag for vim. This flag did fix a co-worker's issue, referenced in this SO question https://stackoverflow.com/questions/22699614/git-commit-messages-lost-by-vi (I've never personally encountered the issue). As best I can tell, this flag exists regardless if the user's vim features a GUI. To be honest, I'm not clear if the flag does anything for just vim and only for gvim. Basing on https://github.com/vim/vim/blob/e29a27f6f8eef8f00d3c2d4cd9811d81cf3026b3/src/main.c#L2124-L2129 & https://github.com/vim/vim/blob/e29a27f6f8eef8f00d3c2d4cd9811d81cf3026b3/src/main.c#L2027-L2032 and vim man pages. I also went with --nofork over -f since I felt long flags are easier to discover. Best I can tell they're equivalent, even if the man page doesn't say so. So, it seems safe to add and "follows" man page description. However, I could see it being considered extraneous if it does nothing for vim specifically. So figured I'd send up a PR just in case.

ben commented 3 years ago

Nice. Thanks!