git: update to v2.46.0

Update to git version v2.46.0, this requires changes for these
upstream commits:

* e7da9385708accf518a80a1e17969020fb361048
  global: introduce `USE_THE_REPOSITORY_VARIABLE` macro

* 9da95bda74cf10e1475384a71fd20914c3b99784
  hash: require hash algorithm in `oidread()` and `oidclr()`

* 30aaff437fddd889ba429b50b96ea4c151c502c5
  refs: pass repo when peeling objects

* c8f815c2083c4b340d4148a15d45c55f2fcc7d3f
  refs: remove functions without ref store

Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
Christian Hesse 2024-07-16 09:45:13 +02:00 committed by Jason A. Donenfeld
parent fb87de795b
commit 09d24d7cd0
20 changed files with 58 additions and 13 deletions

8
cgit.c
View file

@ -6,6 +6,8 @@
* (see COPYING for full license text)
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "cgit.h"
#include "cache.h"
#include "cmd.h"
@ -473,7 +475,8 @@ static char *find_default_branch(struct cgit_repo *repo)
info.req_ref = repo->defbranch;
info.first_ref = NULL;
info.match = 0;
for_each_branch_ref(find_current_ref, &info);
refs_for_each_branch_ref(get_main_ref_store(the_repository),
find_current_ref, &info);
if (info.match)
ref = info.req_ref;
else
@ -490,7 +493,8 @@ static char *guess_defbranch(void)
const char *ref, *refname;
struct object_id oid;
ref = resolve_ref_unsafe("HEAD", 0, &oid, NULL);
ref = refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
"HEAD", 0, &oid, NULL);
if (!ref || !skip_prefix(ref, "refs/heads/", &refname))
return "master";
return xstrdup(refname);