aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2011-10-01 17:43:52 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-03 11:02:56 -0700
commit26c3177ee41897af984fac9148763131562accf2 (patch)
tree52f2c77fdfc087fb5f2c67607576fe14675f5e33 /revision.c
parent83933c9832af91a71337e429a6251f1a3b6d6f60 (diff)
downloadgit-26c3177ee41897af984fac9148763131562accf2.tar.gz
git-26c3177ee41897af984fac9148763131562accf2.tar.xz
revision: factor out add_pending_sha1
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index c46cfaa3e..2e8aa3393 100644
--- a/revision.c
+++ b/revision.c
@@ -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;
@@ -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;
}