diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-17 12:40:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-17 12:40:18 -0700 |
commit | 7d60ad7cc948b1b9e1066a3e740c91651bdc7e8d (patch) | |
tree | 7108636195bd22054fc889ab6eb87b2a0eb98e4a /revision.h | |
parent | 6683463ed6b2da9eed309c305806f9393d1ae728 (diff) | |
download | git-7d60ad7cc948b1b9e1066a3e740c91651bdc7e8d.tar.gz git-7d60ad7cc948b1b9e1066a3e740c91651bdc7e8d.tar.xz |
Make "parse_commit" return the "struct revision" for the commit.
Also, make it a fatal error to pass in a non-commit object. The callers
never checked, so better check here.
This simplifies merge-base further. It's now so trivial that it's almost
ridiculous.
Diffstat (limited to 'revision.h')
-rw-r--r-- | revision.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/revision.h b/revision.h index f965f3fc5..482729575 100644 --- a/revision.h +++ b/revision.h @@ -129,7 +129,7 @@ static unsigned long parse_commit_date(const char *buf) return date; } -static int parse_commit(unsigned char *sha1) +static struct revision * parse_commit(unsigned char *sha1) { struct revision *rev = lookup_rev(sha1); @@ -142,7 +142,7 @@ static int parse_commit(unsigned char *sha1) rev->flags |= SEEN; buffer = bufptr = read_sha1_file(sha1, type, &size); if (!buffer || strcmp(type, "commit")) - return -1; + die("%s is not a commit object", sha1_to_hex(sha1)); bufptr += 46; /* "tree " + "hex sha1" + "\n" */ while (!memcmp(bufptr, "parent ", 7) && !get_sha1_hex(bufptr+7, parent)) { add_relationship(rev, parent); @@ -152,7 +152,7 @@ static int parse_commit(unsigned char *sha1) rev->date = parse_commit_date(bufptr); free(buffer); } - return 0; + return rev; } #endif /* REVISION_H */ |