Re: Bug encountered while comitting
- From
- Matthias Kestenholz <lists@irregular.ch>
- Date
- Mar 25, 2006, 10:23 UTC
- Message-ID
- <20060325102314.GA3825@spinlock.ch>
- In-Reply-To
- <7vwtejxd3u.fsf@assigned-by-dhcp.cox.net>
* Junio C Hamano (junkio@cox.net) wrote:
Show 22 quoted lines
> You are right. commit-tree does not seem to check if it
> successfully wrote the commit object. How about this?
>
> -- >8 --
> diff --git a/commit-tree.c b/commit-tree.c
> index 88871b0..16c1787 100644
> --- a/commit-tree.c
> +++ b/commit-tree.c
> @@ -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;
> }This patch fixes the problem I was encountering (git-update-ref is not executed anymore).
Thank you all for this really great tool!
-- :wq