aboutsummaryrefslogtreecommitdiff
path: root/convert-objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert-objects.c')
-rw-r--r--convert-objects.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/convert-objects.c b/convert-objects.c
index b49bce268..57de37faa 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -2,6 +2,9 @@
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
#include <time.h>
#include "cache.h"
+#include "blob.h"
+#include "commit.h"
+#include "tree.h"
struct entry {
unsigned char old_sha1[20];
@@ -122,7 +125,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
buffer += len;
}
- write_sha1_file(new, newlen, "tree", result_sha1);
+ write_sha1_file(new, newlen, tree_type, result_sha1);
free(new);
return used;
}
@@ -262,8 +265,8 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
memcpy(new + newlen, buffer, size);
newlen += size;
- write_sha1_file(new, newlen, "commit", result_sha1);
- free(new);
+ write_sha1_file(new, newlen, commit_type, result_sha1);
+ free(new);
}
static void convert_commit(void *buffer, unsigned long size, unsigned char *result_sha1)
@@ -297,12 +300,12 @@ static struct entry * convert_entry(unsigned char *sha1)
buffer = xmalloc(size);
memcpy(buffer, data, size);
-
- if (!strcmp(type, "blob")) {
- write_sha1_file(buffer, size, "blob", entry->new_sha1);
- } else if (!strcmp(type, "tree"))
+
+ if (!strcmp(type, blob_type)) {
+ write_sha1_file(buffer, size, blob_type, entry->new_sha1);
+ } else if (!strcmp(type, tree_type))
convert_tree(buffer, size, entry->new_sha1);
- else if (!strcmp(type, "commit"))
+ else if (!strcmp(type, commit_type))
convert_commit(buffer, size, entry->new_sha1);
else
die("unknown object type '%s' in %s", type, sha1_to_hex(sha1));