packed-backend: new module for handling packed references
Now that the interface between `files_ref_store` and `packed_ref_store` is relatively narrow, move the latter into a new module, "refs/packed-backend.h" and "refs/packed-backend.c". It still doesn't quite implement the `ref_store` interface, but it will soon. This commit moves code around and adjusts its visibility, but doesn't change anything. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
d13fa1a9ba
commit
67be7c5a59
18
refs.c
18
refs.c
@ -173,6 +173,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)
|
||||
|
||||
Reference in New Issue
Block a user