git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 89fd415e55e6c199b2c999a49457d3d129223298 1369 bytes (raw)
name: common-main.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
#include "cache.h"
#include "exec-cmd.h"
#include "attr.h"

/*
 * Many parts of Git have subprograms communicate via pipe, expect the
 * upstream of a pipe to die with SIGPIPE when the downstream of a
 * pipe does not need to read all that is written.  Some third-party
 * programs that ignore or block SIGPIPE for their own reason forget
 * to restore SIGPIPE handling to the default before spawning Git and
 * break this carefully orchestrated machinery.
 *
 * Restore the way SIGPIPE is handled to default, which is what we
 * expect.
 */
static void restore_sigpipe_to_default(void)
{
	sigset_t unblock;

	sigemptyset(&unblock);
	sigaddset(&unblock, SIGPIPE);
	sigprocmask(SIG_UNBLOCK, &unblock, NULL);
	signal(SIGPIPE, SIG_DFL);
}

int main(int argc, const char **argv)
{
	int result;

	trace2_initialize_clock();

	/*
	 * Always open file descriptors 0/1/2 to avoid clobbering files
	 * in die().  It also avoids messing up when the pipes are dup'ed
	 * onto stdin/stdout/stderr in the child processes we spawn.
	 */
	sanitize_stdfds();
	restore_sigpipe_to_default();

	git_resolve_executable_dir(argv[0]);

	initialize_the_repository();

	trace2_initialize();
	trace2_cmd_start(argv);
	trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);

	git_setup_gettext();

	attr_start();

	result = cmd_main(argc, argv);

	trace2_cmd_exit(result);

	return result;
}

debug log:

solving 89fd415e55 ...
found 89fd415e55 in https://public-inbox.org/git/20190731231257.GB1933@sigill.intra.peff.net/
found 582a7b1886 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 582a7b18869fb80c94b3a0057e4cb9ced4c6f1c2	common-main.c

applying [1/1] https://public-inbox.org/git/20190731231257.GB1933@sigill.intra.peff.net/
diff --git a/common-main.c b/common-main.c
index 582a7b1886..89fd415e55 100644

Checking patch common-main.c...
Applied patch common-main.c cleanly.

index at:
100644 89fd415e55e6c199b2c999a49457d3d129223298	common-main.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).