summaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-04 13:43:00 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-04 13:43:00 -0700
commit810e1523753553968aac827f57e0e24fc9af6546 (patch)
tree47ec02a8c4a16c1f04e79e10a9b47cbcdfe4f564 /pack-objects.c
parent4c61b7d15a6215fa4dffa33c37c3ef9df80d3f67 (diff)
parent90321c106ca6e36c0e884ca677c9a52dea47bdde (diff)
downloadgit-810e1523753553968aac827f57e0e24fc9af6546.tar.gz
Merge branch 'pe/cleanup'
* pe/cleanup: Replace xmalloc+memset(0) with xcalloc. Use blob_, commit_, tag_, and tree_type throughout.
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/pack-objects.c b/pack-objects.c
index d7ba938af7..9346392150 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1,5 +1,9 @@
#include "cache.h"
#include "object.h"
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
#include "delta.h"
#include "pack.h"
#include "csum-file.h"
@@ -603,7 +607,7 @@ static void add_pbase_tree(struct tree_desc *tree, struct name_path *up)
if (!add_object_entry(sha1, hash, 1))
continue;
- if (!strcmp(type, "tree")) {
+ if (!strcmp(type, tree_type)) {
struct tree_desc sub;
void *elem;
struct name_path me;
@@ -626,7 +630,7 @@ static void add_preferred_base(unsigned char *sha1)
struct tree_desc tree;
void *elem;
- elem = read_object_with_reference(sha1, "tree", &tree.size, NULL);
+ elem = read_object_with_reference(sha1, tree_type, &tree.size, NULL);
tree.buf = elem;
if (!tree.buf)
return;
@@ -684,13 +688,13 @@ static void check_object(struct object_entry *entry)
die("unable to get type of object %s",
sha1_to_hex(entry->sha1));
- if (!strcmp(type, "commit")) {
+ if (!strcmp(type, commit_type)) {
entry->type = OBJ_COMMIT;
- } else if (!strcmp(type, "tree")) {
+ } else if (!strcmp(type, tree_type)) {
entry->type = OBJ_TREE;
- } else if (!strcmp(type, "blob")) {
+ } else if (!strcmp(type, blob_type)) {
entry->type = OBJ_BLOB;
- } else if (!strcmp(type, "tag")) {
+ } else if (!strcmp(type, tag_type)) {
entry->type = OBJ_TAG;
} else
die("unable to pack object %s of type %s",