From 8e4402592574d630cdb5ab4f55a1b7131802ff72 Mon Sep 17 00:00:00 2001 From: Peter Eriksen Date: Sun, 2 Apr 2006 14:44:09 +0200 Subject: Use blob_, commit_, tag_, and tree_type throughout. This replaces occurences of "blob", "commit", "tag", and "tree", where they're really used as type specifiers, which we already have defined global constants for. Signed-off-by: Peter Eriksen Signed-off-by: Junio C Hamano --- convert-objects.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'convert-objects.c') diff --git a/convert-objects.c b/convert-objects.c index b49bce2681..57de37faa5 100644 --- a/convert-objects.c +++ b/convert-objects.c @@ -2,6 +2,9 @@ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ #include #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)); -- cgit v1.2.3