Skip to content

Commit 6a52785

Browse files
committed
Merge 'fix-slow-fetch-w-many-refs'
A regression was introduced into Git for Windows v2.13.* via a half-finished refactoring of the refs handling. This refactoring has been completed in the meantime, but is was only merged into upstream's `master` branch, i.e. it was not integrated into the maintenance track. Git for Windows is used quite a bit in enterprise settings, though, where a large number of refs is quite common, and therefore the regression really hurts. So let's take this regression fix earlier than upstream Git. This fixes #1233. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents b1f7b98 + d1f0a73 commit 6a52785

File tree

8 files changed

+1098
-564
lines changed

8 files changed

+1098
-564
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ LIB_OBJS += reflog-walk.o
844844
LIB_OBJS += refs.o
845845
LIB_OBJS += refs/files-backend.o
846846
LIB_OBJS += refs/iterator.o
847+
LIB_OBJS += refs/packed-backend.o
847848
LIB_OBJS += refs/ref-cache.o
848849
LIB_OBJS += ref-filter.o
849850
LIB_OBJS += remote.o

refs.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,24 @@ int refname_is_safe(const char *refname)
174174
return 1;
175175
}
176176

177+
/*
178+
* Return true if refname, which has the specified oid and flags, can
179+
* be resolved to an object in the database. If the referred-to object
180+
* does not exist, emit a warning and return false.
181+
*/
182+
int ref_resolves_to_object(const char *refname,
183+
const struct object_id *oid,
184+
unsigned int flags)
185+
{
186+
if (flags & REF_ISBROKEN)
187+
return 0;
188+
if (!has_sha1_file(oid->hash)) {
189+
error("%s does not point to a valid object!", refname);
190+
return 0;
191+
}
192+
return 1;
193+
}
194+
177195
char *refs_resolve_refdup(struct ref_store *refs,
178196
const char *refname, int resolve_flags,
179197
unsigned char *sha1, int *flags)

0 commit comments

Comments
 (0)