commit - dfe0a3d83340456fd269a59991dc47c4ac7e3ad3
commit + 01f02e603b4cddeaf18b46197eacc16a88ec3d67
blob - 69b8cbb93b53f21dbe2c44280bb25dc5e5c23beb
blob + 0f2147ddabfceb91722ee79c2285708b832c213d
--- lib/got_lib_repository.h
+++ lib/got_lib_repository.h
struct got_object_id *, struct got_raw_object *);
struct got_raw_object *got_repo_get_cached_raw_object(struct got_repository *,
struct got_object_id *);
-int got_repo_is_packidx_filename(const char *, size_t);
+int got_repo_is_packidx_filename(struct got_repository *, const char *, size_t);
int got_repo_check_packidx_bloom_filter(struct got_repository *,
const char *, struct got_object_id *);
const struct got_error *got_repo_search_packidx(struct got_packidx **, int *,
blob - f13652a605ba2f6beab93cc7c60068345ebb74f7
blob + 8f71f750052c53bc4fb517f377565b417e2bafec
--- lib/read_gitconfig.c
+++ lib/read_gitconfig.c
(*extensions)[(*nextensions)] = extstr;
(*nextensions)++;
}
- if (objectformat && !strcmp(val, "objectformat")) {
+ if (objectformat && !strcmp(ext, "sha256")) {
free(*objectformat);
- *objectformat = strdup(ext);
+ *objectformat = strdup(val);
if (*objectformat == NULL) {
err = got_error_from_errno("strdup");
goto done;
blob - 86cff0ce399b31d574b715bb1b496b778038975d
blob + 0cb03cf8f1a11c0c81f2761391926514bd8793dc
--- lib/read_gitconfig_privsep.c
+++ lib/read_gitconfig_privsep.c
#include <imsg.h>
#include <unistd.h>
+#include <string.h>
+
#include "got_error.h"
#include "got_object.h"
#include "got_repository.h"
ibuf);
if (err)
goto done;
+ if (!strcmp(ext, "sha256"))
+ *object_format = ext;
(*extensions)[i] = ext;
}
}
blob - 12b9dc0ae6a49c8188054c596ce11355019ce40f
blob + 58654437b08e0b54366f259acaa637015d7e2767
--- lib/repository.c
+++ lib/repository.c
}
done:
- free(object_format);
free(repo_gitconfig_path);
return err;
}
"noop", /* Got supports repository format version 1. */
"preciousObjects", /* Supported by gotadmin cleanup. */
"worktreeConfig", /* Got does not care about Git work trees. */
+ "sha256", /* hack */
};
const struct got_error *
}
int
-got_repo_is_packidx_filename(const char *name, size_t len)
+got_repo_is_packidx_filename(struct got_repository *repo, const char *name,
+ size_t len)
{
+ size_t hashlen = SHA1_DIGEST_STRING_LENGTH;
+
+ if (repo->algo == GOT_HASH_SHA256)
+ hashlen = SHA256_DIGEST_STRING_LENGTH;
+
if (len != GOT_PACKIDX_NAMELEN)
return 0;
if (strncmp(name, GOT_PACK_PREFIX, strlen(GOT_PACK_PREFIX)) != 0)
return 0;
- if (strcmp(name + strlen(GOT_PACK_PREFIX) +
- SHA1_DIGEST_STRING_LENGTH - 1, GOT_PACKIDX_SUFFIX) != 0)
+ if (strcmp(name + strlen(GOT_PACK_PREFIX) + hashlen - 1,
+ GOT_PACKIDX_SUFFIX) != 0)
return 0;
return 1;
repo->pack_path_mtime.tv_nsec = sb.st_mtim.tv_nsec;
while ((dent = readdir(packdir)) != NULL) {
- if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen))
+ if (!got_repo_is_packidx_filename(repo, dent->d_name,
+ dent->d_namlen))
continue;
if (asprintf(&path_packidx, "%s/%s", GOT_OBJECTS_PACK_DIR,
}
while ((dent = readdir(packdir)) != NULL) {
- if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen))
+ if (!got_repo_is_packidx_filename(repo, dent->d_name,
+ dent->d_namlen))
continue;
if (asprintf(&path_packidx, "%s/%s", GOT_OBJECTS_PACK_DIR,
blob - 7e0ddba625186dea09ae82437000192bbe37b659
blob + eccc6809e30b6faec649f38baf03d8d883381d2c
--- lib/repository_admin.c
+++ lib/repository_admin.c
goto done;
}
- if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen))
+ if (!got_repo_is_packidx_filename(repo, dent->d_name,
+ dent->d_namlen))
continue;
err = got_packidx_get_packfile_path(&pack_relpath,
blob - 43746dded9d73272ea80f7c66ba0647fcd6eb3f9
blob + 2608d230472ca212437cbdf4daf68d8c8da27ae6
--- libexec/got-read-gitconfig/got-read-gitconfig.c
+++ libexec/got-read-gitconfig/got-read-gitconfig.c
TAILQ_FOREACH(node, &tags->fields, link) {
val = got_gitconfig_get_str(gitconfig, "extensions",
node->field);
- if (get_boolean_val(val))
+ if (get_boolean_val(val) ||
+ !strcmp(node->field, "objectformat"))
nextensions++;
}
TAILQ_FOREACH(node, &tags->fields, link) {
val = got_gitconfig_get_str(gitconfig, "extensions",
node->field);
- if (get_boolean_val(val)) {
- err = send_gitconfig_str(ibuf, node->field);
+ if (get_boolean_val(val) ||
+ !strcmp(node->field, "objectformat")) {
+ /* HACK for objectformat: send 'sha256' */
+ err = send_gitconfig_str(ibuf, val);
if (err)
goto done;
}