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 <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
fc9957b005
commit
8e44025925
@ -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));
|
||||
|
Reference in New Issue
Block a user