]> git.ipfire.org Git - thirdparty/git.git/commitdiff
protocol.h: move definition of DEFAULT_GIT_PORT from cache.h
authorElijah Newren <newren@gmail.com>
Sun, 16 Apr 2023 03:03:05 +0000 (03:03 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2023 21:01:04 +0000 (14:01 -0700)
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>
cache.h
daemon.c
protocol.h

diff --git a/cache.h b/cache.h
index 2f21704da9e1d03a60e1fa8a655b29b48c338463..71e2fe74c4fd6b45c49e987207777ab6020d6f83 100644 (file)
--- a/cache.h
+++ b/cache.h
 #define S_DIFFTREE_IFXMIN_NEQ  0x80000000
 
 
-/*
- * Intensive research over the course of many years has shown that
- * port 9418 is totally unused by anything else. Or
- *
- *     Your search - "port 9418" - did not match any documents.
- *
- * as www.google.com puts it.
- *
- * This port has been properly assigned for git use by IANA:
- * git (Assigned-9418) [I06-050728-0001].
- *
- *     git  9418/tcp   git pack transfer service
- *     git  9418/udp   git pack transfer service
- *
- * with Linus Torvalds <torvalds@osdl.org> as the point of
- * contact. September 2005.
- *
- * See http://www.iana.org/assignments/port-numbers
- */
-#define DEFAULT_GIT_PORT 9418
-
 /*
  * Basic data structures for the directory cache
  */
index db8a31a6ea2145a4c3c2a44caaa82d0ed9e9c278..75c3c064574140bba35174619da87e5914c1884f 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -4,6 +4,7 @@
 #include "config.h"
 #include "environment.h"
 #include "pkt-line.h"
+#include "protocol.h"
 #include "run-command.h"
 #include "setup.h"
 #include "strbuf.h"
index cef1a4a01c7902b0b1181a43580639fcead442ff..de66bf80f8409370069fed46ce97dadb25519d7d 100644 (file)
@@ -1,6 +1,27 @@
 #ifndef PROTOCOL_H
 #define PROTOCOL_H
 
+/*
+ * Intensive research over the course of many years has shown that
+ * port 9418 is totally unused by anything else. Or
+ *
+ *     Your search - "port 9418" - did not match any documents.
+ *
+ * as www.google.com puts it.
+ *
+ * This port has been properly assigned for git use by IANA:
+ * git (Assigned-9418) [I06-050728-0001].
+ *
+ *     git  9418/tcp   git pack transfer service
+ *     git  9418/udp   git pack transfer service
+ *
+ * with Linus Torvalds <torvalds@osdl.org> as the point of
+ * contact. September 2005.
+ *
+ * See http://www.iana.org/assignments/port-numbers
+ */
+#define DEFAULT_GIT_PORT 9418
+
 enum protocol_version {
        protocol_unknown_version = -1,
        protocol_v0 = 0,