Skip to content

Commit

Permalink
commit-tree: check return value from write_sha1_file()
Browse files Browse the repository at this point in the history
... found by Matthias Kestenholz.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Mar 25, 2006
1 parent 79f558a commit 7561d9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions commit-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ int main(int argc, char **argv)
while (fgets(comment, sizeof(comment), stdin) != NULL)
add_buffer(&buffer, &size, "%s", comment);

write_sha1_file(buffer, size, "commit", commit_sha1);
printf("%s\n", sha1_to_hex(commit_sha1));
return 0;
if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
printf("%s\n", sha1_to_hex(commit_sha1));
return 0;
}
else
return 1;
}

0 comments on commit 7561d9f

Please sign in to comment.