git-pickaxe: do not keep commit buffer.
We need the commit buffer data while generating the final result, but until then we do not need them. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
4a0fc95f18
commit
612702e8ea
@ -108,6 +108,7 @@ struct scoreboard {
|
|||||||
/* linked list of blames */
|
/* linked list of blames */
|
||||||
struct blame_entry *ent;
|
struct blame_entry *ent;
|
||||||
|
|
||||||
|
/* look-up a line in the final buffer */
|
||||||
int num_lines;
|
int num_lines;
|
||||||
int *lineno;
|
int *lineno;
|
||||||
};
|
};
|
||||||
@ -188,7 +189,8 @@ static struct origin *find_rename(struct scoreboard *sb,
|
|||||||
|
|
||||||
for (i = 0; i < diff_queued_diff.nr; i++) {
|
for (i = 0; i < diff_queued_diff.nr; i++) {
|
||||||
struct diff_filepair *p = diff_queued_diff.queue[i];
|
struct diff_filepair *p = diff_queued_diff.queue[i];
|
||||||
if (p->status == 'R' && !strcmp(p->one->path, origin->path)) {
|
if ((p->status == 'R' || p->status == 'C') &&
|
||||||
|
!strcmp(p->one->path, origin->path)) {
|
||||||
porigin = find_origin(sb, parent, p->two->path);
|
porigin = find_origin(sb, parent, p->two->path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -457,7 +459,7 @@ static void split_blame(struct scoreboard *sb,
|
|||||||
|
|
||||||
if (1) { /* sanity */
|
if (1) { /* sanity */
|
||||||
struct blame_entry *ent;
|
struct blame_entry *ent;
|
||||||
int lno = 0, corrupt = 0;
|
int lno = sb->ent->lno, corrupt = 0;
|
||||||
|
|
||||||
for (ent = sb->ent; ent; ent = ent->next) {
|
for (ent = sb->ent; ent; ent = ent->next) {
|
||||||
if (lno != ent->lno)
|
if (lno != ent->lno)
|
||||||
@ -467,7 +469,7 @@ static void split_blame(struct scoreboard *sb,
|
|||||||
lno += ent->num_lines;
|
lno += ent->num_lines;
|
||||||
}
|
}
|
||||||
if (corrupt) {
|
if (corrupt) {
|
||||||
lno = 0;
|
lno = sb->ent->lno;
|
||||||
for (ent = sb->ent; ent; ent = ent->next) {
|
for (ent = sb->ent; ent; ent = ent->next) {
|
||||||
printf("L %8d l %8d n %8d\n",
|
printf("L %8d l %8d n %8d\n",
|
||||||
lno, ent->lno, ent->num_lines);
|
lno, ent->lno, ent->num_lines);
|
||||||
@ -508,10 +510,9 @@ static void blame_chunk(struct scoreboard *sb,
|
|||||||
int tlno, int plno, int same,
|
int tlno, int plno, int same,
|
||||||
struct origin *target, struct origin *parent)
|
struct origin *target, struct origin *parent)
|
||||||
{
|
{
|
||||||
struct blame_entry *e, *n;
|
struct blame_entry *e;
|
||||||
|
|
||||||
for (e = sb->ent; e; e = n) {
|
for (e = sb->ent; e; e = e->next) {
|
||||||
n = e->next;
|
|
||||||
if (e->guilty || e->suspect != target)
|
if (e->guilty || e->suspect != target)
|
||||||
continue;
|
continue;
|
||||||
if (same <= e->s_lno)
|
if (same <= e->s_lno)
|
||||||
@ -556,7 +557,7 @@ static unsigned ent_score(struct scoreboard *sb, struct blame_entry *e)
|
|||||||
if (e->score)
|
if (e->score)
|
||||||
return e->score;
|
return e->score;
|
||||||
|
|
||||||
score = 0;
|
score = 1;
|
||||||
cp = nth_line(sb, e->lno);
|
cp = nth_line(sb, e->lno);
|
||||||
ep = nth_line(sb, e->lno + e->num_lines);
|
ep = nth_line(sb, e->lno + e->num_lines);
|
||||||
while (cp < ep) {
|
while (cp < ep) {
|
||||||
@ -933,6 +934,15 @@ static void get_commit_info(struct commit *commit,
|
|||||||
static char committer_buf[1024];
|
static char committer_buf[1024];
|
||||||
static char summary_buf[1024];
|
static char summary_buf[1024];
|
||||||
|
|
||||||
|
/* We've operated without save_commit_buffer, so
|
||||||
|
* we now need to populate them for output.
|
||||||
|
*/
|
||||||
|
if (!commit->buffer) {
|
||||||
|
char type[20];
|
||||||
|
unsigned long size;
|
||||||
|
commit->buffer =
|
||||||
|
read_sha1_file(commit->object.sha1, type, &size);
|
||||||
|
}
|
||||||
ret->author = author_buf;
|
ret->author = author_buf;
|
||||||
get_ac_line(commit->buffer, "\nauthor ",
|
get_ac_line(commit->buffer, "\nauthor ",
|
||||||
sizeof(author_buf), author_buf, &ret->author_mail,
|
sizeof(author_buf), author_buf, &ret->author_mail,
|
||||||
@ -1214,6 +1224,8 @@ int cmd_pickaxe(int argc, const char **argv, const char *prefix)
|
|||||||
const char *final_commit_name = NULL;
|
const char *final_commit_name = NULL;
|
||||||
char type[10];
|
char type[10];
|
||||||
|
|
||||||
|
save_commit_buffer = 0;
|
||||||
|
|
||||||
opt = 0;
|
opt = 0;
|
||||||
bottom = top = 0;
|
bottom = top = 0;
|
||||||
seen_dashdash = 0;
|
seen_dashdash = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user