{"thread":{"id":"38410","subject":"[PATCH] move MAXDEPTH definition to the cache.h","startedAt":"2015-01-20T18:16:37Z","lastAt":"2015-01-21T00:24:07Z","messageCount":3,"participants":["Alexander Kuleshov","Torsten Bögershausen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"254942","messageId":"1421777797-14781-1-git-send-email-kuleshovmail@gmail.com","threadId":"38410","inReplyTo":null,"subject":"[PATCH] move MAXDEPTH definition to the cache.h","fromName":"Alexander Kuleshov","fromEmail":"kuleshovmail@gmail.com","sentAt":"2015-01-20T18:16:37Z","receivedAt":"2015-01-20T18:16:37Z","isPatch":true,"sender":{"key":"kuleshovmail@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2699235?v=4"},"body":"There are a couple of source code files as abspath.c, lockfile.c and etc...,\nwhich defines MAXDEPTH macro. All of these definitions are the same, so let's\nmove MAXDEPTH definition to the <cache.h> instead of directly declaration of\nthis macro in all these files.\n\nSigned-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>\n---\n abspath.c   | 3 ---\n cache.h     | 1 +\n http-push.c | 3 ---\n lockfile.c  | 4 ----\n refs.c      | 2 --\n 5 files changed, 1 insertion(+), 12 deletions(-)\n\ndiff --git a/abspath.c b/abspath.c\nindex 5edb4e7..9209522 100644\n--- a/abspath.c\n+++ b/abspath.c\n@@ -11,9 +11,6 @@ int is_directory(const char *path)\n \treturn (!stat(path, &st) && S_ISDIR(st.st_mode));\n }\n \n-/* We allow \"recursive\" symbolic links. Only within reason, though. */\n-#define MAXDEPTH 5\n-\n /*\n  * Return the real path (i.e., absolute path, with symlinks resolved\n  * and extra slashes removed) equivalent to the specified path.  (If\ndiff --git a/cache.h b/cache.h\nindex 64aa287..cac85b7 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1010,6 +1010,7 @@ extern int read_ref(const char *refname, unsigned char *sha1);\n  * Caps and underscores refers to the special refs, such as HEAD,\n  * FETCH_HEAD and friends, that all live outside of the refs/ directory.\n  */\n+#define MAXDEPTH 5\n #define RESOLVE_REF_READING 0x01\n #define RESOLVE_REF_NO_RECURSE 0x02\n #define RESOLVE_REF_ALLOW_BAD_NAME 0x04\ndiff --git a/http-push.c b/http-push.c\nindex 0beb7ab..bb1f82e 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -70,9 +70,6 @@ enum XML_Status {\n #define FETCHING (1u<<18)\n #define PUSHING  (1u<<19)\n \n-/* We allow \"recursive\" symbolic refs. Only within reason, though */\n-#define MAXDEPTH 5\n-\n static int pushing;\n static int aborted;\n static signed char remote_dir_exists[256];\ndiff --git a/lockfile.c b/lockfile.c\nindex 9889277..88d0102 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -59,10 +59,6 @@ static void trim_last_path_component(struct strbuf *path)\n \tstrbuf_setlen(path, i);\n }\n \n-\n-/* We allow \"recursive\" symbolic links. Only within reason, though */\n-#define MAXDEPTH 5\n-\n /*\n  * path contains a path that might be a symlink.\n  *\ndiff --git a/refs.c b/refs.c\nindex 872cb26..c37879f 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -1335,8 +1335,6 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs)\n \treturn get_ref_dir(refs->loose);\n }\n \n-/* We allow \"recursive\" symbolic refs. Only within reason, though */\n-#define MAXDEPTH 5\n #define MAXREFLEN (1024)\n \n /*\n-- \n2.3.0.rc0.286.ga3dc223.dirty\n"},{"id":"254945","messageId":"54BEABBC.9070302@web.de","threadId":"38410","inReplyTo":"1421777797-14781-1-git-send-email-kuleshovmail@gmail.com","subject":"Re: [PATCH] move MAXDEPTH definition to the cache.h","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2015-01-20T19:25:48Z","receivedAt":"2015-01-20T19:25:48Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"> --- a/cache.h\n> +++ b/cache.h\n> @@ -1010,6 +1010,7 @@ extern int read_ref(const char *refname, unsigned char *sha1);\n>   * Caps and underscores refers to the special refs, such as HEAD,\n>   * FETCH_HEAD and friends, that all live outside of the refs/ directory.\n>   */\n\nWhat happened to the comment line ?\nShould it go away or better stay ?\n\nWhen we move the definition to a common file,\nit is not 100% clear what MAXDEPTH is about,\nand the comment is even more important, I think:\n\n> +/* We allow \"recursive\" symbolic links. Only within reason, though. */\n> +#define MAXDEPTH 5\n\nOn the other hand, if we find a better name for that definition,\nwe may skip the comment.\n\nA first suggestion may be\n#define MAXDEPTH_FOR_SYMLINKS 5\nbut other variants are possible.\n"},{"id":"254970","messageId":"xmqqfvb5yo9k.fsf@gitster.dls.corp.google.com","threadId":"38410","inReplyTo":"1421777797-14781-1-git-send-email-kuleshovmail@gmail.com","subject":"Re: [PATCH] move MAXDEPTH definition to the cache.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-21T00:24:07Z","receivedAt":"2015-01-21T00:24:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Kuleshov <kuleshovmail@gmail.com> writes:\n\n> There are a couple of source code files as abspath.c, lockfile.c and etc...,\n> which defines MAXDEPTH macro. All of these definitions are the same,...\n\nAre they the same by design (because there are logical linkage\nbetween these values and there is a reason why they must share the\nsame value), or are they happen to be the same (i.e. one can be\nraised for some reason without affecting others)?\n\nI am guessing that it is the latter, and if that is the case, then\nthey should not be made into a single symbol.\n"}]}