Commit Diff


commit - 42b6bfc81cdd6a9cba14c9d8916aeddbe561a356
commit + d4eec7d5a4198505ab2a13e256444d57033846b9
blob - f6291e8407d22bd8dea75ff94f8f7b88ebafcb78
blob + da3ccae2d248a1264070ba019dbe1c73c139be25
--- include/got_error.h
+++ include/got_error.h
@@ -184,6 +184,7 @@
 #define GOT_ERR_COMMIT_BAD_AUTHOR 166
 #define GOT_ERR_UID		167
 #define GOT_ERR_GID		168
+#define GOT_ERR_OBJECT_FORMAT	169
 
 struct got_error {
         int code;
blob - 18676e3c533b4136f64b290ce440b864ea3a206c
blob + 041e7748b452c5223c6388a6944046e6697efb3f
--- lib/error.c
+++ lib/error.c
@@ -235,6 +235,7 @@ static const struct got_error got_errors[] = {
 	    "make Git unhappy" },
 	{ GOT_ERR_UID, "bad user ID" },
 	{ GOT_ERR_GID, "bad group ID" },
+	{ GOT_ERR_OBJECT_FORMAT, "object format not supported" },
 };
 
 static struct got_custom_error {
blob - 5096af954e1ccadb5899b44af5069d80f24b817e
blob + 4e019bb51759120b39ec4c08a477f9e58b998a4b
--- lib/repository.c
+++ lib/repository.c
@@ -791,7 +791,7 @@ got_repo_open(struct got_repository **repop, const cha
 	err = read_gitconfig(repo, global_gitconfig_path);
 	if (err)
 		goto done;
-	if (repo->gitconfig_repository_format_version != 0) {
+	if (repo->gitconfig_repository_format_version > 1) {
 		err = got_error_path(path, GOT_ERR_GIT_REPO_FORMAT);
 		goto done;
 	}
@@ -799,6 +799,18 @@ got_repo_open(struct got_repository **repop, const cha
 		char *ext = repo->extnames[i];
 		char *val = repo->extvals[i];
 		int j, supported = 0;
+
+		if (repo->gitconfig_repository_format_version == 1 &&
+		    strcasecmp(ext, "objectformat") == 0) {
+			if (strcmp(val, "sha1") == 0)
+				continue;
+			if (strcmp(val, "sha256") == 0) {
+				repo->algo = GOT_HASH_SHA256;
+				continue;
+			}
+			err = got_error_path(val, GOT_ERR_OBJECT_FORMAT);
+			goto done;
+		}
 
 		if (!is_boolean_val(val)) {
 			err = got_error_path(ext, GOT_ERR_GIT_REPO_EXT);