git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
0d92124ca63925e20da1ccac8d62b64e86047fd8 blob 1601 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
75
76
77
 
#include "cache.h"

#include "builtin.h"
#include "config.h"
#include "hook.h"
#include "parse-options.h"
#include "strbuf.h"

static const char * const builtin_hook_usage[] = {
	N_("git hook list <hookname>"),
	NULL
};

static int list(int argc, const char **argv, const char *prefix)
{
	struct list_head *head, *pos;
	struct hook *item;
	struct strbuf hookname = STRBUF_INIT;
	int porcelain = 0;

	struct option list_options[] = {
		OPT_BOOL(0, "porcelain", &porcelain,
			 "format for execution by a script"),
		OPT_END(),
	};

	argc = parse_options(argc, argv, prefix, list_options,
			     builtin_hook_usage, 0);

	if (argc < 1) {
		usage_msg_opt("a hookname must be provided to operate on.",
			      builtin_hook_usage, list_options);
	}



	strbuf_addstr(&hookname, argv[0]);

	head = hook_list(&hookname);

	if (list_empty(head)) {
		printf(_("no commands configured for hook '%s'\n"),
		       hookname.buf);
		return 0;
	}

	list_for_each(pos, head) {
		item = list_entry(pos, struct hook, list);
		if (item) {
			if (porcelain)
				printf("%s\n", item->command.buf);
			else
				printf("%s:\t%s\n",
				       config_scope_name(item->origin),
				       item->command.buf);
		}
	}

	clear_hook_list();
	strbuf_release(&hookname);

	return 0;
}

int cmd_hook(int argc, const char **argv, const char *prefix)
{
	struct option builtin_hook_options[] = {
		OPT_END(),
	};
	if (argc < 2)
		usage_with_options(builtin_hook_usage, builtin_hook_options);

	if (!strcmp(argv[1], "list"))
		return list(argc - 1, argv + 1, prefix);

	usage_with_options(builtin_hook_usage, builtin_hook_options);
}
debug log:

solving 0d92124ca6 ...
found 0d92124ca6 in https://public-inbox.org/git/20200909004939.1942347-5-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200728222455.3023400-5-emilyshaffer@google.com/
found a0759a4c26 in https://public-inbox.org/git/20200728222455.3023400-4-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200909004939.1942347-4-emilyshaffer@google.com/
found b2bbc84d4d in https://public-inbox.org/git/20191210023335.49987-2-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200909004939.1942347-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200728222455.3023400-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200521185414.43760-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20200414005457.3505-2-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20201205014607.1464119-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20201014232447.3050579-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20210311021037.3001235-3-emilyshaffer@google.com/ ||
	https://public-inbox.org/git/20201222000220.1491091-3-emilyshaffer@google.com/

applying [1/13] https://public-inbox.org/git/20191210023335.49987-2-emilyshaffer@google.com/
diff --git a/builtin/hook.c b/builtin/hook.c
new file mode 100644
index 0000000000..b2bbc84d4d

Checking patch builtin/hook.c...
Applied patch builtin/hook.c cleanly.

skipping https://public-inbox.org/git/20200909004939.1942347-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20200728222455.3023400-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20200521185414.43760-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20200414005457.3505-2-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20201205014607.1464119-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20201014232447.3050579-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20210311021037.3001235-3-emilyshaffer@google.com/ for b2bbc84d4d
skipping https://public-inbox.org/git/20201222000220.1491091-3-emilyshaffer@google.com/ for b2bbc84d4d
index at:
100644 b2bbc84d4d98aa1380c6fac60370dae76eb10f55	builtin/hook.c

applying [2/13] https://public-inbox.org/git/20200728222455.3023400-4-emilyshaffer@google.com/
diff --git a/builtin/hook.c b/builtin/hook.c
index b2bbc84d4d..a0759a4c26 100644

Checking patch builtin/hook.c...
Applied patch builtin/hook.c cleanly.

skipping https://public-inbox.org/git/20200909004939.1942347-4-emilyshaffer@google.com/ for a0759a4c26
index at:
100644 a0759a4c26eb7a5bc65fd0738efddecde3f337fe	builtin/hook.c

applying [3/13] https://public-inbox.org/git/20200909004939.1942347-5-emilyshaffer@google.com/
diff --git a/builtin/hook.c b/builtin/hook.c
index a0759a4c26..0d92124ca6 100644

Checking patch builtin/hook.c...
Applied patch builtin/hook.c cleanly.

skipping https://public-inbox.org/git/20200728222455.3023400-5-emilyshaffer@google.com/ for 0d92124ca6
index at:
100644 0d92124ca63925e20da1ccac8d62b64e86047fd8	builtin/hook.c

Code repositories for project(s) associated with this 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).