Skip to content

Commit

Permalink
Merge 'fix-slow-fetch-w-many-refs'
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Aug 25, 2017
2 parents 61b3a67 + 8ec617c commit 121eceb
Show file tree
Hide file tree
Showing 8 changed files with 1,097 additions and 564 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ LIB_OBJS += reflog-walk.o
LIB_OBJS += refs.o
LIB_OBJS += refs/files-backend.o
LIB_OBJS += refs/iterator.o
LIB_OBJS += refs/packed-backend.o
LIB_OBJS += refs/ref-cache.o
LIB_OBJS += ref-filter.o
LIB_OBJS += remote.o
Expand Down
18 changes: 18 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ int refname_is_safe(const char *refname)
return 1;
}

/*
* Return true if refname, which has the specified oid and flags, can
* be resolved to an object in the database. If the referred-to object
* does not exist, emit a warning and return false.
*/
int ref_resolves_to_object(const char *refname,
const struct object_id *oid,
unsigned int flags)
{
if (flags & REF_ISBROKEN)
return 0;
if (!has_sha1_file(oid->hash)) {
error("%s does not point to a valid object!", refname);
return 0;
}
return 1;
}

char *refs_resolve_refdup(struct ref_store *refs,
const char *refname, int resolve_flags,
unsigned char *sha1, int *flags)
Expand Down
Loading

0 comments on commit 121eceb

Please sign in to comment.