protocol.h: move definition of DEFAULT_GIT_PORT from cache.h

Michael J Gruber noticed that connection via the git:// protocol no longer worked after a recent header clean-up. This was caused by funny interaction of few gotchas. First, a necessary definition #define DEFAULT_GIT_PORT 9418 was made invisible to a place where const char *port = STR(DEFAULT_GIT_PORT); was expecting to turn the integer into "9418" with a clever STR() macro, and ended up stringifying it to const char *port = "DEFAULT_GIT_PORT"; without giving any chance to compilers to notice such a mistake. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Apr 16, 2023 at 03:03 UTC 331b094eec6d4c937af6e59df2a537112e4d8205
3 files changed +22 -21
cache.h
-21
@@ -39,27 +39,6 @@
39 #define S_DIFFTREE_IFXMIN_NEQ 0x80000000
40
41
42 -/*
43 - * Intensive research over the course of many years has shown that
44 - * port 9418 is totally unused by anything else. Or
45 - *
46 - * Your search - "port 9418" - did not match any documents.
47 - *
48 - * as www.google.com puts it.
49 - *
50 - * This port has been properly assigned for git use by IANA:
51 - * git (Assigned-9418) [I06-050728-0001].
52 - *
53 - * git 9418/tcp git pack transfer service
54 - * git 9418/udp git pack transfer service
55 - *
56 - * with Linus Torvalds <torvalds@osdl.org> as the point of
57 - * contact. September 2005.
58 - *
59 - * See http://www.iana.org/assignments/port-numbers
60 - */
61 -#define DEFAULT_GIT_PORT 9418
62 -
42 /*
43 * Basic data structures for the directory cache
44 */
daemon.c
+1
@@ -4,6 +4,7 @@
4 #include "config.h"
5 #include "environment.h"
6 #include "pkt-line.h"
7 +#include "protocol.h"
8 #include "run-command.h"
9 #include "setup.h"
10 #include "strbuf.h"
protocol.h
+21
@@ -1,6 +1,27 @@
1 #ifndef PROTOCOL_H
2 #define PROTOCOL_H
3
4 +/*
5 + * Intensive research over the course of many years has shown that
6 + * port 9418 is totally unused by anything else. Or
7 + *
8 + * Your search - "port 9418" - did not match any documents.
9 + *
10 + * as www.google.com puts it.
11 + *
12 + * This port has been properly assigned for git use by IANA:
13 + * git (Assigned-9418) [I06-050728-0001].
14 + *
15 + * git 9418/tcp git pack transfer service
16 + * git 9418/udp git pack transfer service
17 + *
18 + * with Linus Torvalds <torvalds@osdl.org> as the point of
19 + * contact. September 2005.
20 + *
21 + * See http://www.iana.org/assignments/port-numbers
22 + */
23 +#define DEFAULT_GIT_PORT 9418
24 +
25 enum protocol_version {
26 protocol_unknown_version = -1,
27 protocol_v0 = 0,