t7900-subtree.sh: use the $( ... ) construct for command substitution
[gitweb.git] / environment.c
index 0a15349cfe38ab76b1d1cc94878cec2a8d754bbd..c3c860603da817b75d73bc446d03944e1963e874 100644 (file)
@@ -10,6 +10,7 @@
 #include "cache.h"
 #include "refs.h"
 #include "fmt-merge-msg.h"
+#include "commit.h"
 
 int trust_executable_bit = 1;
 int trust_ctime = 1;
@@ -44,7 +45,7 @@ const char *editor_program;
 const char *askpass_program;
 const char *excludes_file;
 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
-int read_replace_refs = 1; /* NEEDSWORK: rename to use_replace_refs */
+int check_replace_refs = 1;
 enum eol core_eol = EOL_UNSET;
 enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
@@ -97,6 +98,7 @@ const char * const local_repo_env[] = {
        INDEX_ENVIRONMENT,
        NO_REPLACE_OBJECTS_ENVIRONMENT,
        GIT_PREFIX_ENVIRONMENT,
+       GIT_SHALLOW_FILE_ENVIRONMENT,
        NULL
 };
 
@@ -124,6 +126,7 @@ static char *expand_namespace(const char *raw_namespace)
 static void setup_git_env(void)
 {
        const char *gitfile;
+       const char *shallow_file;
 
        git_dir = getenv(GIT_DIR_ENVIRONMENT);
        if (!git_dir)
@@ -144,9 +147,12 @@ static void setup_git_env(void)
        if (!git_graft_file)
                git_graft_file = git_pathdup("info/grafts");
        if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
-               read_replace_refs = 0;
+               check_replace_refs = 0;
        namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
        namespace_len = strlen(namespace);
+       shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
+       if (shallow_file)
+               set_alternate_shallow_file(shallow_file, 0);
 }
 
 int is_bare_repository(void)
@@ -171,7 +177,7 @@ const char *get_git_namespace(void)
 
 const char *strip_namespace(const char *namespaced_ref)
 {
-       if (prefixcmp(namespaced_ref, get_git_namespace()) != 0)
+       if (!starts_with(namespaced_ref, get_git_namespace()))
                return NULL;
        return namespaced_ref + namespace_len;
 }