git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
2bb65ecf3f567952f2e9ab75b8458b2b9d1cde0b blob 2256 bytes (raw)

 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
#include "builtin.h"
#include "config.h"
#include "parse-options.h"

static char const * const env__helper_usage[] = {
	N_("git env--helper [--mode-bool | --mode-ulong] --env-variable=<VAR> --env-default=<DEF> [<options>]"),
	NULL
};

int cmd_env__helper(int argc, const char **argv, const char *prefix)
{
	enum {
		ENV_HELPER_BOOL = 1,
		ENV_HELPER_ULONG,
	} cmdmode = 0;
	int exit_code = 0;
	int quiet = 0;
	const char *env_variable = NULL;
	const char *env_default = NULL;
	int ret;
	int ret_int, tmp_int;
	unsigned long ret_ulong, tmp_ulong;
	struct option opts[] = {
		OPT_CMDMODE(0, "mode-bool", &cmdmode,
			    N_("invoke git_env_bool(...)"), ENV_HELPER_BOOL),
		OPT_CMDMODE(0, "mode-ulong", &cmdmode,
			    N_("invoke git_env_ulong(...)"), ENV_HELPER_ULONG),
		OPT_STRING(0, "variable", &env_variable, N_("name"),
			   N_("which environment variable to ask git_env_*(...) about")),
		OPT_STRING(0, "default", &env_default, N_("value"),
			   N_("what default value does git_env_*(...) fall back on?")),
		OPT_BOOL(0, "exit-code", &exit_code,
			 N_("exit code determined by truth of the git_env_*() function")),
		OPT_BOOL(0, "quiet", &quiet,
			 N_("don't print the git_env_*() return value")),
		OPT_END(),
	};

	if (parse_options(argc, argv, prefix, opts, env__helper_usage, 0))
		usage_with_options(env__helper_usage, opts);
	if (!env_variable || !env_default ||
	    !*env_variable || !*env_default)
		usage_with_options(env__helper_usage, opts);

	switch (cmdmode) {
	case ENV_HELPER_BOOL:
		tmp_int = strtol(env_default, (char **)&env_default, 10);
		if (*env_default) {
			error(_("option `--default' expects a numerical value with `--mode-bool`"));
			usage_with_options(env__helper_usage, opts);
		}
		ret_int = git_env_bool(env_variable, tmp_int);
		if (!quiet)
			printf("%d\n", ret_int);
		ret = ret_int;
		break;
	case ENV_HELPER_ULONG:
		tmp_ulong = strtoll(env_default, (char **)&env_default, 10);
		if (*env_default) {
			error(_("option `--default' expects a numerical value with `--mode-ulong`"));
			usage_with_options(env__helper_usage, opts);
		}
		ret_ulong = git_env_ulong(env_variable, tmp_ulong);
		if (!quiet)
			printf("%lu\n", ret_ulong);
		ret = ret_ulong;
		break;
	}

	if (exit_code)
		return !ret;

	return 0;
}
debug log:

solving 2bb65ecf3f ...
found 2bb65ecf3f in https://public-inbox.org/git/20190620210915.11297-3-avarab@gmail.com/ ||
	https://public-inbox.org/git/20190619233046.27503-2-avarab@gmail.com/

applying [1/2] https://public-inbox.org/git/20190620210915.11297-3-avarab@gmail.com/
diff --git a/builtin/env--helper.c b/builtin/env--helper.c
new file mode 100644
index 0000000000..2bb65ecf3f

Checking patch builtin/env--helper.c...
Applied patch builtin/env--helper.c cleanly.

skipping https://public-inbox.org/git/20190619233046.27503-2-avarab@gmail.com/ for 2bb65ecf3f
index at:
100644 2bb65ecf3f567952f2e9ab75b8458b2b9d1cde0b	builtin/env--helper.c

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git