Skip to content

Commit

Permalink
revision: factor out add_pending_sha1
Browse files Browse the repository at this point in the history
This function is a combination of the static get_reference and
add_pending_object.  It can be used to easily queue objects by hash.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Oct 3, 2011
1 parent 83933c9 commit 26c3177
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ static struct object *get_reference(struct rev_info *revs, const char *name, con
return object;
}

void add_pending_sha1(struct rev_info *revs, const char *name,
const unsigned char *sha1, unsigned int flags)
{
struct object *object = get_reference(revs, name, sha1, flags);
add_pending_object(revs, object, name);
}

static struct commit *handle_commit(struct rev_info *revs, struct object *object, const char *name)
{
unsigned long flags = object->flags;
Expand Down Expand Up @@ -832,9 +839,7 @@ struct all_refs_cb {
static int handle_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct object *object = get_reference(cb->all_revs, path, sha1,
cb->all_flags);
add_pending_object(cb->all_revs, object, path);
add_pending_sha1(cb->all_revs, path, sha1, cb->all_flags);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ extern void add_object(struct object *obj,
const char *name);

extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name);
extern void add_pending_sha1(struct rev_info *revs, const char *name, const unsigned char *sha1, unsigned int flags);

extern void add_head_to_pending(struct rev_info *);

Expand Down

0 comments on commit 26c3177

Please sign in to comment.