char hex[40];
unsigned char sha1[20];
static char path[PATH_MAX], link[PATH_MAX];
- const char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
+ const char *git_dir;
+
+ git_dir = gitenv(GIT_DIR_ENVIRONMENT);
+ if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
snprintf(path, sizeof(path), "%s/HEAD", git_dir);
if (readlink(path, link, sizeof(link)) < 0)
if (standalone && check_full)
die("Only one of --standalone or --full can be used.");
if (standalone)
- unsetenv("GIT_ALTERNATE_OBJECT_DIRECTORIES");
+ putenv("GIT_ALTERNATE_OBJECT_DIRECTORIES=");
fsck_head_link();
fsck_object_dir(get_object_directory());
if (check_full) {
- int j;
+ struct alternate_object_database *alt;
struct packed_git *p;
prepare_alt_odb();
- for (j = 0; alt_odb[j].base; j++) {
+ for (alt = alt_odb_list; alt; alt = alt->next) {
char namebuf[PATH_MAX];
- int namelen = alt_odb[j].name - alt_odb[j].base;
- memcpy(namebuf, alt_odb[j].base, namelen);
+ int namelen = alt->name - alt->base;
+ memcpy(namebuf, alt->base, namelen);
namebuf[namelen - 1] = 0;
fsck_object_dir(namebuf);
}