summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-01 22:43:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-09-01 22:46:12 (GMT)
commit4947367267cbcd0ca528711b2393613e2e817878 (patch)
treec2a9a053ecadf7b61ef3d6017bb8ba08804342b6 /builtin
parentbeba25abbc34a07e07ce933210cda15202ef76cc (diff)
downloadgit-4947367267cbcd0ca528711b2393613e2e817878.zip
git-4947367267cbcd0ca528711b2393613e2e817878.tar.gz
git-4947367267cbcd0ca528711b2393613e2e817878.tar.bz2
list-objects: pass callback data to show_objects()
The traverse_commit_list() API takes two callback functions, one to show commit objects, and the other to show other kinds of objects. Even though the former has a callback data parameter, so that the callback does not have to rely on global state, the latter does not. Give the show_objects() callback the same callback data parameter. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pack-objects.c4
-rw-r--r--builtin/rev-list.c10
2 files changed, 10 insertions, 4 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index f402a84..fca6cb5 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1936,7 +1936,9 @@ static void show_commit(struct commit *commit, void *data)
commit->object.flags |= OBJECT_ADDED;
}
-static void show_object(struct object *obj, const struct name_path *path, const char *last)
+static void show_object(struct object *obj,
+ const struct name_path *path, const char *last,
+ void *data)
{
char *name = path_name(path, last);
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index f5ce487..920b91c 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -168,15 +168,19 @@ static void finish_commit(struct commit *commit, void *data)
commit->buffer = NULL;
}
-static void finish_object(struct object *obj, const struct name_path *path, const char *name)
+static void finish_object(struct object *obj,
+ const struct name_path *path, const char *name,
+ void *cb_data)
{
if (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1))
die("missing blob object '%s'", sha1_to_hex(obj->sha1));
}
-static void show_object(struct object *obj, const struct name_path *path, const char *component)
+static void show_object(struct object *obj,
+ const struct name_path *path, const char *component,
+ void *cb_data)
{
- finish_object(obj, path, component);
+ finish_object(obj, path, component, cb_data);
show_object_with_name(stdout, obj, path, component);
}