diff: convert diff_change to struct object_id
Convert diff_change to take a struct object_id. In addition convert the function pointer type 'change_fn_t' to also take a struct object_id. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
55497b8c9e
commit
94a0097a41
|
@ -236,7 +236,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||||
old_oid = &ce->oid;
|
old_oid = &ce->oid;
|
||||||
new_oid = changed ? &null_oid : &ce->oid;
|
new_oid = changed ? &null_oid : &ce->oid;
|
||||||
diff_change(&revs->diffopt, oldmode, newmode,
|
diff_change(&revs->diffopt, oldmode, newmode,
|
||||||
old_oid->hash, new_oid->hash,
|
old_oid, new_oid,
|
||||||
!is_null_oid(old_oid),
|
!is_null_oid(old_oid),
|
||||||
!is_null_oid(new_oid),
|
!is_null_oid(new_oid),
|
||||||
ce->name, 0, dirty_submodule);
|
ce->name, 0, dirty_submodule);
|
||||||
|
@ -367,7 +367,7 @@ static int show_modified(struct rev_info *revs,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
diff_change(&revs->diffopt, oldmode, mode,
|
diff_change(&revs->diffopt, oldmode, mode,
|
||||||
old->oid.hash, oid->hash, 1, !is_null_oid(oid),
|
&old->oid, oid, 1, !is_null_oid(oid),
|
||||||
old->name, 0, dirty_submodule);
|
old->name, 0, dirty_submodule);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
14
diff.c
14
diff.c
|
@ -5127,9 +5127,9 @@ void diff_addremove(struct diff_options *options,
|
||||||
|
|
||||||
void diff_change(struct diff_options *options,
|
void diff_change(struct diff_options *options,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const struct object_id *old_oid,
|
||||||
const unsigned char *new_sha1,
|
const struct object_id *new_oid,
|
||||||
int old_sha1_valid, int new_sha1_valid,
|
int old_oid_valid, int new_oid_valid,
|
||||||
const char *concatpath,
|
const char *concatpath,
|
||||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
||||||
{
|
{
|
||||||
|
@ -5142,8 +5142,8 @@ void diff_change(struct diff_options *options,
|
||||||
|
|
||||||
if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
|
if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
|
||||||
SWAP(old_mode, new_mode);
|
SWAP(old_mode, new_mode);
|
||||||
SWAP(old_sha1, new_sha1);
|
SWAP(old_oid, new_oid);
|
||||||
SWAP(old_sha1_valid, new_sha1_valid);
|
SWAP(old_oid_valid, new_oid_valid);
|
||||||
SWAP(old_dirty_submodule, new_dirty_submodule);
|
SWAP(old_dirty_submodule, new_dirty_submodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5153,8 +5153,8 @@ void diff_change(struct diff_options *options,
|
||||||
|
|
||||||
one = alloc_filespec(concatpath);
|
one = alloc_filespec(concatpath);
|
||||||
two = alloc_filespec(concatpath);
|
two = alloc_filespec(concatpath);
|
||||||
fill_filespec(one, old_sha1, old_sha1_valid, old_mode);
|
fill_filespec(one, old_oid->hash, old_oid_valid, old_mode);
|
||||||
fill_filespec(two, new_sha1, new_sha1_valid, new_mode);
|
fill_filespec(two, new_oid->hash, new_oid_valid, new_mode);
|
||||||
one->dirty_submodule = old_dirty_submodule;
|
one->dirty_submodule = old_dirty_submodule;
|
||||||
two->dirty_submodule = new_dirty_submodule;
|
two->dirty_submodule = new_dirty_submodule;
|
||||||
p = diff_queue(&diff_queued_diff, one, two);
|
p = diff_queue(&diff_queued_diff, one, two);
|
||||||
|
|
13
diff.h
13
diff.h
|
@ -23,9 +23,9 @@ typedef int (*pathchange_fn_t)(struct diff_options *options,
|
||||||
|
|
||||||
typedef void (*change_fn_t)(struct diff_options *options,
|
typedef void (*change_fn_t)(struct diff_options *options,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const struct object_id *old_oid,
|
||||||
const unsigned char *new_sha1,
|
const struct object_id *new_oid,
|
||||||
int old_sha1_valid, int new_sha1_valid,
|
int old_oid_valid, int new_oid_valid,
|
||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule);
|
unsigned old_dirty_submodule, unsigned new_dirty_submodule);
|
||||||
|
|
||||||
|
@ -253,10 +253,9 @@ extern void diff_addremove(struct diff_options *,
|
||||||
|
|
||||||
extern void diff_change(struct diff_options *,
|
extern void diff_change(struct diff_options *,
|
||||||
unsigned mode1, unsigned mode2,
|
unsigned mode1, unsigned mode2,
|
||||||
const unsigned char *sha1,
|
const struct object_id *old_oid,
|
||||||
const unsigned char *sha2,
|
const struct object_id *new_oid,
|
||||||
int sha1_valid,
|
int old_oid_valid, int new_oid_valid,
|
||||||
int sha2_valid,
|
|
||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
unsigned dirty_submodule1, unsigned dirty_submodule2);
|
unsigned dirty_submodule1, unsigned dirty_submodule2);
|
||||||
|
|
||||||
|
|
|
@ -414,9 +414,9 @@ static void file_add_remove(struct diff_options *options,
|
||||||
|
|
||||||
static void file_change(struct diff_options *options,
|
static void file_change(struct diff_options *options,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const struct object_id *old_oid,
|
||||||
const unsigned char *new_sha1,
|
const struct object_id *new_oid,
|
||||||
int old_sha1_valid, int new_sha1_valid,
|
int old_oid_valid, int new_oid_valid,
|
||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int emit_diff_first_parent_only(struct diff_options *opt, struct combine_
|
||||||
{
|
{
|
||||||
struct combine_diff_parent *p0 = &p->parent[0];
|
struct combine_diff_parent *p0 = &p->parent[0];
|
||||||
if (p->mode && p0->mode) {
|
if (p->mode && p0->mode) {
|
||||||
opt->change(opt, p0->mode, p->mode, p0->oid.hash, p->oid.hash,
|
opt->change(opt, p0->mode, p->mode, &p0->oid, &p->oid,
|
||||||
1, 1, p->path, 0, 0);
|
1, 1, p->path, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue