mirror of
https://github.com/git/git.git
synced 2024-11-17 22:44:49 +01:00
Merge branch 'jc/diffstat' into next
* jc/diffstat: diff --stat: show complete rewrites consistently. Makefile: remove and create libgit.a from scratch.
This commit is contained in:
commit
9849efb321
2 changed files with 15 additions and 5 deletions
2
Makefile
2
Makefile
|
@ -575,7 +575,7 @@ $(patsubst git-%$X,%.o,$(PROGRAMS)): $(GITLIBS)
|
||||||
$(DIFF_OBJS): diffcore.h
|
$(DIFF_OBJS): diffcore.h
|
||||||
|
|
||||||
$(LIB_FILE): $(LIB_OBJS)
|
$(LIB_FILE): $(LIB_OBJS)
|
||||||
$(AR) rcs $@ $(LIB_OBJS)
|
rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
|
||||||
|
|
||||||
XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o
|
XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o
|
||||||
|
|
||||||
|
|
18
diff.c
18
diff.c
|
@ -485,7 +485,8 @@ static void builtin_diff(const char *name_a,
|
||||||
static void builtin_diffstat(const char *name_a, const char *name_b,
|
static void builtin_diffstat(const char *name_a, const char *name_b,
|
||||||
struct diff_filespec *one,
|
struct diff_filespec *one,
|
||||||
struct diff_filespec *two,
|
struct diff_filespec *two,
|
||||||
struct diffstat_t *diffstat)
|
struct diffstat_t *diffstat,
|
||||||
|
int complete_rewrite)
|
||||||
{
|
{
|
||||||
mmfile_t mf1, mf2;
|
mmfile_t mf1, mf2;
|
||||||
struct diffstat_file *data;
|
struct diffstat_file *data;
|
||||||
|
@ -496,7 +497,13 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
|
||||||
data->is_unmerged = 1;
|
data->is_unmerged = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (complete_rewrite) {
|
||||||
|
diff_populate_filespec(one, 0);
|
||||||
|
diff_populate_filespec(two, 0);
|
||||||
|
data->deleted = count_lines(one->data, one->size);
|
||||||
|
data->added = count_lines(two->data, two->size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
|
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
|
||||||
die("unable to read files to diff");
|
die("unable to read files to diff");
|
||||||
|
|
||||||
|
@ -1055,10 +1062,11 @@ static void run_diffstat(struct diff_filepair *p, struct diff_options *o,
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *other;
|
const char *other;
|
||||||
|
int complete_rewrite = 0;
|
||||||
|
|
||||||
if (DIFF_PAIR_UNMERGED(p)) {
|
if (DIFF_PAIR_UNMERGED(p)) {
|
||||||
/* unmerged */
|
/* unmerged */
|
||||||
builtin_diffstat(p->one->path, NULL, NULL, NULL, diffstat);
|
builtin_diffstat(p->one->path, NULL, NULL, NULL, diffstat, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1076,9 @@ static void run_diffstat(struct diff_filepair *p, struct diff_options *o,
|
||||||
diff_fill_sha1_info(p->one);
|
diff_fill_sha1_info(p->one);
|
||||||
diff_fill_sha1_info(p->two);
|
diff_fill_sha1_info(p->two);
|
||||||
|
|
||||||
builtin_diffstat(name, other, p->one, p->two, diffstat);
|
if (p->status == DIFF_STATUS_MODIFIED && p->score)
|
||||||
|
complete_rewrite = 1;
|
||||||
|
builtin_diffstat(name, other, p->one, p->two, diffstat, complete_rewrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void diff_setup(struct diff_options *options)
|
void diff_setup(struct diff_options *options)
|
||||||
|
|
Loading…
Reference in a new issue