Staging
v0.5.1
Revision 07efc6a6b6e5098ccd2dcce853be421b7dd1e244 authored by Ramsay Jones on 04 August 2006, 21:01:30 UTC, committed by Junio C Hamano on 05 August 2006, 00:30:24 UTC
Unlike git-commit, git-format-patch was not picking up and using the
user.email config variable for the email part of the committer info.
I was forced to use the GIT_COMMITTER_EMAIL environment variable to
override the default <user@localhost.localdomain>. The fix was to
simply move the call to setup_ident() to come before the git_config()
call.

Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 4e273c9
Raw File
strbuf.c
#include <stdio.h>
#include <stdlib.h>
#include "strbuf.h"
#include "cache.h"

void strbuf_init(struct strbuf *sb) {
	sb->buf = NULL;
	sb->eof = sb->alloc = sb->len = 0;
}

static void strbuf_begin(struct strbuf *sb) {
	free(sb->buf);
	strbuf_init(sb);
}

static void inline strbuf_add(struct strbuf *sb, int ch) {
	if (sb->alloc <= sb->len) {
		sb->alloc = sb->alloc * 3 / 2 + 16;
		sb->buf = xrealloc(sb->buf, sb->alloc);
	}
	sb->buf[sb->len++] = ch;
}

static void strbuf_end(struct strbuf *sb) {
	strbuf_add(sb, 0);
}

void read_line(struct strbuf *sb, FILE *fp, int term) {
	int ch;
	strbuf_begin(sb);
	if (feof(fp)) {
		sb->eof = 1;
		return;
	}
	while ((ch = fgetc(fp)) != EOF) {
		if (ch == term)
			break;
		strbuf_add(sb, ch);
	}
	if (ch == EOF && sb->len == 0)
		sb->eof = 1;
	strbuf_end(sb);
}

back to top