Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin_diff_tree(): make it obvious that function wants two entries
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sat, 25 May 2013 09:08:03 +0000
(11:08 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 28 May 2013 16:25:00 +0000
(09:25 -0700)
Instead of accepting an array and using exactly two elements from the
array, take two single (struct object_array_entry *) arguments.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
df835d3
)
diff --git
a/builtin/diff.c
b/builtin/diff.c
index 8c2af6cb43ca62f253e07903a8e3cce1080e335b..abdd613a83f60bc9a7fc395e421d09a672bb5c59 100644
(file)
--- a/
builtin/diff.c
+++ b/
builtin/diff.c
@@
-153,7
+153,8
@@
static int builtin_diff_index(struct rev_info *revs,
static int builtin_diff_tree(struct rev_info *revs,
int argc, const char **argv,
static int builtin_diff_tree(struct rev_info *revs,
int argc, const char **argv,
- struct object_array_entry *ent)
+ struct object_array_entry *ent0,
+ struct object_array_entry *ent1)
{
const unsigned char *(sha1[2]);
int swap = 0;
{
const unsigned char *(sha1[2]);
int swap = 0;
@@
-161,13
+162,14
@@
static int builtin_diff_tree(struct rev_info *revs,
if (argc > 1)
usage(builtin_diff_usage);
if (argc > 1)
usage(builtin_diff_usage);
- /* We saw two trees, ent[0] and ent[1].
- * if ent[1] is uninteresting, they are swapped
+ /*
+ * We saw two trees, ent0 and ent1. If ent1 is uninteresting,
+ * swap them.
*/
*/
- if (ent
[1].
item->flags & UNINTERESTING)
+ if (ent
1->
item->flags & UNINTERESTING)
swap = 1;
swap = 1;
- sha1[swap] = ent
[0].
item->sha1;
- sha1[1-swap] = ent
[1].
item->sha1;
+ sha1[swap] = ent
0->
item->sha1;
+ sha1[1-swap] = ent
1->
item->sha1;
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
log_tree_diff_flush(revs);
return 0;
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
log_tree_diff_flush(revs);
return 0;
@@
-403,7
+405,7
@@
int cmd_diff(int argc, const char **argv, const char *prefix)
else if (ents == 1)
result = builtin_diff_index(&rev, argc, argv);
else if (ents == 2)
else if (ents == 1)
result = builtin_diff_index(&rev, argc, argv);
else if (ents == 2)
- result = builtin_diff_tree(&rev, argc, argv,
ent
);
+ result = builtin_diff_tree(&rev, argc, argv,
&ent[0], &ent[1]
);
else if (ent[0].item->flags & UNINTERESTING) {
/*
* diff A...B where there is at least one merge base
else if (ent[0].item->flags & UNINTERESTING) {
/*
* diff A...B where there is at least one merge base
@@
-412,8
+414,7
@@
int cmd_diff(int argc, const char **argv, const char *prefix)
* between the base and B. Note that we pick one
* merge base at random if there are more than one.
*/
* between the base and B. Note that we pick one
* merge base at random if there are more than one.
*/
- ent[1] = ent[ents-1];
- result = builtin_diff_tree(&rev, argc, argv, ent);
+ result = builtin_diff_tree(&rev, argc, argv, &ent[0], &ent[ents-1]);
} else
result = builtin_diff_combined(&rev, argc, argv,
ent, ents);
} else
result = builtin_diff_combined(&rev, argc, argv,
ent, ents);