mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
environment: remove namespace_len variable
Use 'skip_prefix' instead of 'starts_with' so that we can drop the need to keep around 'namespace_len'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7aee274fb4
commit
bf08c8cfc1
|
@ -98,7 +98,6 @@ char *git_work_tree_cfg;
|
||||||
static char *work_tree;
|
static char *work_tree;
|
||||||
|
|
||||||
static const char *namespace;
|
static const char *namespace;
|
||||||
static size_t namespace_len;
|
|
||||||
|
|
||||||
static const char *super_prefix;
|
static const char *super_prefix;
|
||||||
|
|
||||||
|
@ -190,7 +189,6 @@ void setup_git_env(void)
|
||||||
git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base
|
git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base
|
||||||
: "refs/replace/");
|
: "refs/replace/");
|
||||||
namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
|
namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
|
||||||
namespace_len = strlen(namespace);
|
|
||||||
shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
|
shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
|
||||||
if (shallow_file)
|
if (shallow_file)
|
||||||
set_alternate_shallow_file(shallow_file, 0);
|
set_alternate_shallow_file(shallow_file, 0);
|
||||||
|
@ -231,9 +229,10 @@ const char *get_git_namespace(void)
|
||||||
|
|
||||||
const char *strip_namespace(const char *namespaced_ref)
|
const char *strip_namespace(const char *namespaced_ref)
|
||||||
{
|
{
|
||||||
if (!starts_with(namespaced_ref, get_git_namespace()))
|
const char *out;
|
||||||
return NULL;
|
if (skip_prefix(namespaced_ref, get_git_namespace(), &out))
|
||||||
return namespaced_ref + namespace_len;
|
return out;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *get_super_prefix(void)
|
const char *get_super_prefix(void)
|
||||||
|
|
Loading…
Reference in a new issue