Staging
v0.5.2
https://github.com/git/git
Revision 9ccb64c8e0791a865ad520bcfff4b02cc7c50097 authored by Junio C Hamano on 05 October 2006, 09:26:12 UTC, committed by Junio C Hamano on 05 October 2006, 09:26:12 UTC
It is silly to keep using git-tar-tree in dist target when the
command gives a big deprecation warning when called.  Instead,
use "git-archive --format=tar" which we recommend to our users.

Update gitweb's snapshot feature to use git-archive for the same
reason.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 6030649
Raw File
Tip revision: 9ccb64c8e0791a865ad520bcfff4b02cc7c50097 authored by Junio C Hamano on 05 October 2006, 09:26:12 UTC
tar-tree deprecation: we eat our own dog food.
Tip revision: 9ccb64c
write_or_die.c
#include "cache.h"

void write_or_die(int fd, const void *buf, size_t count)
{
	const char *p = buf;
	ssize_t written;

	while (count > 0) {
		written = xwrite(fd, p, count);
		if (written == 0)
			die("disk full?");
		else if (written < 0) {
			if (errno == EPIPE)
				exit(0);
			die("write error (%s)", strerror(errno));
		}
		count -= written;
		p += written;
	}
}

int write_or_whine(int fd, const void *buf, size_t count, const char *msg)
{
	const char *p = buf;
	ssize_t written;

	while (count > 0) {
		written = xwrite(fd, p, count);
		if (written == 0) {
			fprintf(stderr, "%s: disk full?\n", msg);
			return 0;
		}
		else if (written < 0) {
			if (errno == EPIPE)
				exit(0);
			fprintf(stderr, "%s: write error (%s)\n",
				msg, strerror(errno));
			return 0;
		}
		count -= written;
		p += written;
	}

	return 1;
}
back to top