* [PATCH] move MAXDEPTH definition to the cache.h
@ 2015-01-20 18:16 Alexander Kuleshov
2015-01-20 19:25 ` Torsten Bögershausen
2015-01-21 0:24 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Kuleshov @ 2015-01-20 18:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Alexander Kuleshov
There are a couple of source code files as abspath.c, lockfile.c and etc...,
which defines MAXDEPTH macro. All of these definitions are the same, so let's
move MAXDEPTH definition to the <cache.h> instead of directly declaration of
this macro in all these files.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
abspath.c | 3 ---
cache.h | 1 +
http-push.c | 3 ---
lockfile.c | 4 ----
refs.c | 2 --
5 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/abspath.c b/abspath.c
index 5edb4e7..9209522 100644
--- a/abspath.c
+++ b/abspath.c
@@ -11,9 +11,6 @@ int is_directory(const char *path)
return (!stat(path, &st) && S_ISDIR(st.st_mode));
}
-/* We allow "recursive" symbolic links. Only within reason, though. */
-#define MAXDEPTH 5
-
/*
* Return the real path (i.e., absolute path, with symlinks resolved
* and extra slashes removed) equivalent to the specified path. (If
diff --git a/cache.h b/cache.h
index 64aa287..cac85b7 100644
--- a/cache.h
+++ b/cache.h
@@ -1010,6 +1010,7 @@ extern int read_ref(const char *refname, unsigned char *sha1);
* Caps and underscores refers to the special refs, such as HEAD,
* FETCH_HEAD and friends, that all live outside of the refs/ directory.
*/
+#define MAXDEPTH 5
#define RESOLVE_REF_READING 0x01
#define RESOLVE_REF_NO_RECURSE 0x02
#define RESOLVE_REF_ALLOW_BAD_NAME 0x04
diff --git a/http-push.c b/http-push.c
index 0beb7ab..bb1f82e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -70,9 +70,6 @@ enum XML_Status {
#define FETCHING (1u<<18)
#define PUSHING (1u<<19)
-/* We allow "recursive" symbolic refs. Only within reason, though */
-#define MAXDEPTH 5
-
static int pushing;
static int aborted;
static signed char remote_dir_exists[256];
diff --git a/lockfile.c b/lockfile.c
index 9889277..88d0102 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -59,10 +59,6 @@ static void trim_last_path_component(struct strbuf *path)
strbuf_setlen(path, i);
}
-
-/* We allow "recursive" symbolic links. Only within reason, though */
-#define MAXDEPTH 5
-
/*
* path contains a path that might be a symlink.
*
diff --git a/refs.c b/refs.c
index 872cb26..c37879f 100644
--- a/refs.c
+++ b/refs.c
@@ -1335,8 +1335,6 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs)
return get_ref_dir(refs->loose);
}
-/* We allow "recursive" symbolic refs. Only within reason, though */
-#define MAXDEPTH 5
#define MAXREFLEN (1024)
/*
--
2.3.0.rc0.286.ga3dc223.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] move MAXDEPTH definition to the cache.h
2015-01-20 18:16 [PATCH] move MAXDEPTH definition to the cache.h Alexander Kuleshov
@ 2015-01-20 19:25 ` Torsten Bögershausen
2015-01-21 0:24 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2015-01-20 19:25 UTC (permalink / raw)
To: Alexander Kuleshov, Junio C Hamano; +Cc: git
> --- a/cache.h
> +++ b/cache.h
> @@ -1010,6 +1010,7 @@ extern int read_ref(const char *refname, unsigned char *sha1);
> * Caps and underscores refers to the special refs, such as HEAD,
> * FETCH_HEAD and friends, that all live outside of the refs/ directory.
> */
What happened to the comment line ?
Should it go away or better stay ?
When we move the definition to a common file,
it is not 100% clear what MAXDEPTH is about,
and the comment is even more important, I think:
> +/* We allow "recursive" symbolic links. Only within reason, though. */
> +#define MAXDEPTH 5
On the other hand, if we find a better name for that definition,
we may skip the comment.
A first suggestion may be
#define MAXDEPTH_FOR_SYMLINKS 5
but other variants are possible.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] move MAXDEPTH definition to the cache.h
2015-01-20 18:16 [PATCH] move MAXDEPTH definition to the cache.h Alexander Kuleshov
2015-01-20 19:25 ` Torsten Bögershausen
@ 2015-01-21 0:24 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2015-01-21 0:24 UTC (permalink / raw)
To: Alexander Kuleshov; +Cc: git
Alexander Kuleshov <kuleshovmail@gmail.com> writes:
> There are a couple of source code files as abspath.c, lockfile.c and etc...,
> which defines MAXDEPTH macro. All of these definitions are the same,...
Are they the same by design (because there are logical linkage
between these values and there is a reason why they must share the
same value), or are they happen to be the same (i.e. one can be
raised for some reason without affecting others)?
I am guessing that it is the latter, and if that is the case, then
they should not be made into a single symbol.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-21 0:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 18:16 [PATCH] move MAXDEPTH definition to the cache.h Alexander Kuleshov
2015-01-20 19:25 ` Torsten Bögershausen
2015-01-21 0:24 ` Junio C Hamano
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 NNTP newsgroup(s).