mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
refs: move object peeling into "object.c"
Peeling an object has nothing to do with refs, but we still have the code in "refs.c". Move it over into "object.c", which is a more natural place to put it. Ideally, we'd also move `peel_iterated_oid()` over into "object.c". But this function is tied to the refs interfaces because it uses a global ref iterator variable to optimize peeling when the iterator already has the peeled object ID readily available. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
330a2ae60b
commit
19c76e8235
22
refs.c
22
refs.c
@@ -19,7 +19,6 @@
|
||||
#include "object-store-ll.h"
|
||||
#include "object.h"
|
||||
#include "path.h"
|
||||
#include "tag.h"
|
||||
#include "submodule.h"
|
||||
#include "worktree.h"
|
||||
#include "strvec.h"
|
||||
@@ -425,27 +424,6 @@ static int for_each_filter_refs(const char *refname,
|
||||
return filter->fn(refname, oid, flags, filter->cb_data);
|
||||
}
|
||||
|
||||
enum peel_status peel_object(const struct object_id *name, struct object_id *oid)
|
||||
{
|
||||
struct object *o = lookup_unknown_object(the_repository, name);
|
||||
|
||||
if (o->type == OBJ_NONE) {
|
||||
int type = oid_object_info(the_repository, name, NULL);
|
||||
if (type < 0 || !object_as_type(o, type, 0))
|
||||
return PEEL_INVALID;
|
||||
}
|
||||
|
||||
if (o->type != OBJ_TAG)
|
||||
return PEEL_NON_TAG;
|
||||
|
||||
o = deref_tag_noverify(o);
|
||||
if (!o)
|
||||
return PEEL_INVALID;
|
||||
|
||||
oidcpy(oid, &o->oid);
|
||||
return PEEL_PEELED;
|
||||
}
|
||||
|
||||
struct warn_if_dangling_data {
|
||||
struct ref_store *refs;
|
||||
FILE *fp;
|
||||
|
||||
Reference in New Issue
Block a user