summaryrefslogtreecommitdiff
path: root/commit-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-26 18:32:45 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-26 18:32:45 -0700
commite7afa1115beb071512ac2b8d6b7487eadbfccc74 (patch)
treee1473acf5c9da91c36ab64d8c941fe7bd632090e /commit-tree.c
parentb8ed7f0f40743dae6111c8950ba55051933298ca (diff)
parent9af0b8dbe2fb252262412a11254e2bcc6ffb87bb (diff)
downloadgit-e7afa1115beb071512ac2b8d6b7487eadbfccc74.tar.gz
Merge branch 'master' into jc/cache-tree
* master: t0000-basic: more commit-tree tests. commit-tree.c: check_valid() microoptimization. Fix filename verification when in a subdirectory rebase: typofix. socksetup: don't return on set_reuse_addr() error
Diffstat (limited to 'commit-tree.c')
-rw-r--r--commit-tree.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/commit-tree.c b/commit-tree.c
index e91af4bd36..bad72e89e8 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -45,14 +45,13 @@ static void add_buffer(char **bufp, unsigned int *sizep, const char *fmt, ...)
static void check_valid(unsigned char *sha1, const char *expect)
{
- void *buf;
char type[20];
- unsigned long size;
- buf = read_sha1_file(sha1, type, &size);
- if (!buf || strcmp(type, expect))
- die("%s is not a valid '%s' object", sha1_to_hex(sha1), expect);
- free(buf);
+ if (sha1_object_info(sha1, type, NULL))
+ die("%s is not a valid object", sha1_to_hex(sha1));
+ if (expect && strcmp(type, expect))
+ die("%s is not a valid '%s' object", sha1_to_hex(sha1),
+ expect);
}
/*