diff options
author | Brandon Williams <bmwill@google.com> | 2017-05-30 10:30:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-02 09:36:07 +0900 |
commit | c26022ea8f54649ed6b3b545dd3158907abe5d2c (patch) | |
tree | a774987137bafa841a9eed9ce3248ef83a8167e0 | |
parent | diff: convert diff_index_show_file to struct object_id (diff) | |
download | tgif-c26022ea8f54649ed6b3b545dd3158907abe5d2c.tar.xz |
diff: convert diff_addremove to struct object_id
Convert diff_addremove to take a struct object_id. In addtion convert
the function pointer type 'add_remove_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>
-rw-r--r-- | diff-lib.c | 6 | ||||
-rw-r--r-- | diff.c | 8 | ||||
-rw-r--r-- | diff.h | 8 | ||||
-rw-r--r-- | revision.c | 4 | ||||
-rw-r--r-- | tree-diff.c | 8 |
5 files changed, 17 insertions, 17 deletions
diff --git a/diff-lib.c b/diff-lib.c index 2c838aaf43..7984ff962f 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -210,14 +210,14 @@ int run_diff_files(struct rev_info *revs, unsigned int option) continue; } diff_addremove(&revs->diffopt, '-', ce->ce_mode, - ce->oid.hash, + &ce->oid, !is_null_oid(&ce->oid), ce->name, 0); continue; } else if (revs->diffopt.ita_invisible_in_index && ce_intent_to_add(ce)) { diff_addremove(&revs->diffopt, '+', ce->ce_mode, - EMPTY_BLOB_SHA1_BIN, 0, + &empty_tree_oid, 0, ce->name, 0); continue; } @@ -260,7 +260,7 @@ static void diff_index_show_file(struct rev_info *revs, unsigned dirty_submodule) { diff_addremove(&revs->diffopt, prefix[0], mode, - oid->hash, oid_valid, ce->name, dirty_submodule); + oid, oid_valid, ce->name, dirty_submodule); } static int get_stat_data(const struct cache_entry *ce, @@ -5081,8 +5081,8 @@ static int is_submodule_ignored(const char *path, struct diff_options *options) void diff_addremove(struct diff_options *options, int addremove, unsigned mode, - const unsigned char *sha1, - int sha1_valid, + const struct object_id *oid, + int oid_valid, const char *concatpath, unsigned dirty_submodule) { struct diff_filespec *one, *two; @@ -5114,9 +5114,9 @@ void diff_addremove(struct diff_options *options, two = alloc_filespec(concatpath); if (addremove != '+') - fill_filespec(one, sha1, sha1_valid, mode); + fill_filespec(one, oid->hash, oid_valid, mode); if (addremove != '-') { - fill_filespec(two, sha1, sha1_valid, mode); + fill_filespec(two, oid->hash, oid_valid, mode); two->dirty_submodule = dirty_submodule; } @@ -31,8 +31,8 @@ typedef void (*change_fn_t)(struct diff_options *options, typedef void (*add_remove_fn_t)(struct diff_options *options, int addremove, unsigned mode, - const unsigned char *sha1, - int sha1_valid, + const struct object_id *oid, + int oid_valid, const char *fullpath, unsigned dirty_submodule); typedef void (*diff_format_fn_t)(struct diff_queue_struct *q, @@ -247,8 +247,8 @@ extern int diff_can_quit_early(struct diff_options *); extern void diff_addremove(struct diff_options *, int addremove, unsigned mode, - const unsigned char *sha1, - int sha1_valid, + const struct object_id *oid, + int oid_valid, const char *fullpath, unsigned dirty_submodule); extern void diff_change(struct diff_options *, diff --git a/revision.c b/revision.c index 475d5b2dc1..71519193ca 100644 --- a/revision.c +++ b/revision.c @@ -401,8 +401,8 @@ static int tree_difference = REV_TREE_SAME; static void file_add_remove(struct diff_options *options, int addremove, unsigned mode, - const unsigned char *sha1, - int sha1_valid, + const struct object_id *oid, + int oid_valid, const char *fullpath, unsigned dirty_submodule) { int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD; diff --git a/tree-diff.c b/tree-diff.c index e164e532b2..f2c747ea50 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -78,21 +78,21 @@ static int emit_diff_first_parent_only(struct diff_options *opt, struct combine_ 1, 1, p->path, 0, 0); } else { - const unsigned char *sha1; + const struct object_id *oid; unsigned int mode; int addremove; if (p->mode) { addremove = '+'; - sha1 = p->oid.hash; + oid = &p->oid; mode = p->mode; } else { addremove = '-'; - sha1 = p0->oid.hash; + oid = &p0->oid; mode = p0->mode; } - opt->add_remove(opt, addremove, mode, sha1, 1, p->path, 0); + opt->add_remove(opt, addremove, mode, oid, 1, p->path, 0); } return 0; /* we are done with p */ |