... while waiting for the child process to finish. The Git wrapper serves, among other things, as git-cmd.exe. In that role, its primary purpose is to provide an interactive cmd window that knows where to find Git. A secondary use of git-cmd.exe is to be able to launch other console processes that know about Git, e.g. when ConsoleZ wants to call an interactive Bash (it cannot call git-bash.exe because that would open a new MinTTY window). To this end, git-cmd.exe supports the --command=... command-line option. The interactive bash would be called like this: git-cmd --command=usr\bin\bash.exe -l -i The command-line arguments after the --command=... options are simply passed through to the command itself. If no --command=... option is specified, git-cmd.exe defaults to cmd.exe. Once git-cmd.exe is launched, it finds the top-level directory of the Git for Windows installation and then launches the command as a child process. And this is where things get a little bit tricky: When the user presses CTRL-C, the cmd window receives WM_KEYDOWN/WM_KEYUP messages which are then handled by the TranslateMessage function that generates a CTRL-C event that is sent to the console processes running in the console window (i.e. both git-cmd.exe and the child process). If no Console Ctrl Handlers have been registered, the git-cmd.exe process will simply be terminated, without having waited for the interactive Bash to quit (it does not quit, of course, because it handles Ctrl+C by terminating any process launched from within the Bash). Now both cmd and the Bash compete for user input. Luckily, the solution is very easy: the Win32 API sports a SetConsoleCtrlHandler() function to register/unregister Console Ctrl Handlers. When the NULL pointer is registered as "handler", it "causes the calling process to ignore CTRL+C input": https://msdn.microsoft.com/en-us/library/windows/desktop/ms686016.aspx This is exactly what we need here: while waiting for the child processes to finish, the git-cmd.exe process itself should not be interruptible by the user. Immediately after the child process terminates, we unregister the Console Ctrl Handler. Note: we need to be careful with changes to the Git wrapper as it serves many other purposes in addition to git-cmd.exe. For example, it serves as the cmd\git.exe as well as all of the git-<builtin>.exe stand-ins. So do we want the same Ctrl+C behavior even in those instances? Yes: If the user interrupts using Ctrl+C, the child process should terminate before the Git wrapper. Also note: We cannot override the Console Ctrl Handler with a function that simply always returns TRUE: this would prevent the console window opened via git-cmd.exe from closing, since the Console Ctrl Handler *also* handles "signals generated by the system when the user closes the console, logs off, or shuts down the system." [jes: changed the patch to conform with the surrounding coding style, to pass NULL as Console Ctrl Handler and unregister it as soon as appropriate, fixed commit message to be more accurate and informative, added link to the SetConsoleCtrlHandler() documentation.] This fixes https://github.com/git-for-windows/git/pull/205 Signed-off-by: Christophe Bucher Developer <christophe.bucher@laposte.net> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Git - fast, scalable, distributed revision control system
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.
Please read the file INSTALL for installation instructions.
Many Git online resources are accessible from http://git-scm.com/ including full documentation and Git related tools.
See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-commandname.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with "man gittutorial" or "git help tutorial", and the documentation of each command with "man git-commandname" or "git help commandname".
CVS users may also want to read Documentation/gitcvs-migration.txt ("man gitcvs-migration" or "git help cvs-migration" if git is installed).
The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just "subscribe git" in the body to majordomo@vger.kernel.org. The mailing list archives are available at http://news.gmane.org/gmane.comp.version-control.git/, http://marc.info/?l=git and other archival sites.
The maintainer frequently sends the "What's cooking" reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.
The name "git" was given by Linus Torvalds when he wrote the very first version. He described the tool as "the stupid content tracker" and the name as (depending on your mood):
- random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.
- stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
- "global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
- "goddamn idiotic truckload of sh*t": when it breaks