Re: [RFC/PATCH v3 2/3] sha1_file: prepare for adding alternates on demand
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:00
Hi, On Thu, 22 Jan 2009, Lars Hjemli wrote:
quoted hunk ↗ jump to hunk
@@ -285,9 +286,10 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative /* Detect cases where alternate disappeared */ if (!is_directory(ent->base)) { - error("object directory %s does not exist; " - "check .git/objects/info/alternates.", - ent->base); + if (!quiet) + error("object directory %s does not exist; " + "check .git/objects/info/alternates.", + ent->base); free(ent); return -1; }[...]@@ -2573,3 +2579,11 @@ int read_pack_header(int fd, struct pack_header *header) return PH_ERROR_PROTOCOL; return 0; } + +int add_alt_odb(char *path, int quiet) +{ + int err = link_alt_odb_entry(path, strlen(path), NULL, 0, quiet); + if (!err) + prepare_packed_git_one(path, 0); + return err; +}
FWIW my concern is not at all addressed. A future user of add_alt_odb() (and possibly your users in rare cases, too) can trigger the error that suggests looking into the alternates. Leaving the human user puzzled. Ciao, Dscho