char path[PATH_MAX];
size_t len = strlen(suspect);
+ if (PATH_MAX <= len + strlen("/objects"))
+ die("Too long path: %.*s", 60, suspect);
strcpy(path, suspect);
if (getenv(DB_ENVIRONMENT)) {
if (access(getenv(DB_ENVIRONMENT), X_OK))
const char *gitdirenv;
const char *gitfile_dir;
int len, offset, ceil_offset, root_len;
- int current_device = 0, one_filesystem = 0;
+ dev_t current_device = 0;
+ int one_filesystem = 1;
struct stat buf;
/*
* etc.
*/
offset = len = strlen(cwd);
- one_filesystem = git_env_bool("GIT_ONE_FILESYSTEM", 0);
+ one_filesystem = !git_env_bool("GIT_DISCOVERY_ACROSS_FILESYSTEM", 0);
if (one_filesystem) {
if (stat(".", &buf))
die_errno("failed to stat '.'");
}
cwd[offset] = '\0';
die("Not a git repository (or any parent up to mount parent %s)\n"
- "Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is set.", cwd);
+ "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", cwd);
}
}
if (chdir("..")) {
return check_repository_format_gently(NULL);
}
+/*
+ * Returns the "prefix", a path to the current working directory
+ * relative to the work tree root, or NULL, if the current working
+ * directory is not a strict subdirectory of the work tree root. The
+ * prefix always ends with a '/' character.
+ */
const char *setup_git_directory(void)
{
const char *retval = setup_git_directory_gently(NULL);