projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move "void *util" from "struct object" into "struct commit"
[git.git]
/
builtin-diff.c
diff --git
a/builtin-diff.c
b/builtin-diff.c
index
636edbf
..
6ac3d4b
100644
(file)
--- a/
builtin-diff.c
+++ b/
builtin-diff.c
@@
-84,8
+84,7
@@
static void stuff_change(struct diff_options *opt,
if (opt->reverse_diff) {
unsigned tmp;
if (opt->reverse_diff) {
unsigned tmp;
- const
- const unsigned char *tmp_u;
+ const unsigned char *tmp_u;
const char *tmp_c;
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
tmp_u = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_u;
const char *tmp_c;
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
tmp_u = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_u;
@@
-123,7
+122,7
@@
static int builtin_diff_b_f(struct rev_info *revs,
stuff_change(&revs->diffopt,
canon_mode(st.st_mode), canon_mode(st.st_mode),
blob[0].sha1, null_sha1,
stuff_change(&revs->diffopt,
canon_mode(st.st_mode), canon_mode(st.st_mode),
blob[0].sha1, null_sha1,
-
blob[0].name
, path);
+
path
, path);
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
@@
-133,7
+132,9
@@
static int builtin_diff_blobs(struct rev_info *revs,
int argc, const char **argv,
struct blobinfo *blob)
{
int argc, const char **argv,
struct blobinfo *blob)
{
- /* Blobs */
+ /* Blobs: the arguments are reversed when setup_revisions()
+ * picked them up.
+ */
unsigned mode = canon_mode(S_IFREG | 0644);
while (1 < argc) {
unsigned mode = canon_mode(S_IFREG | 0644);
while (1 < argc) {
@@
-146,8
+147,8
@@
static int builtin_diff_blobs(struct rev_info *revs,
}
stuff_change(&revs->diffopt,
mode, mode,
}
stuff_change(&revs->diffopt,
mode, mode,
- blob[
0].sha1, blob[1
].sha1,
- blob[
1].name, blob[1
].name);
+ blob[
1].sha1, blob[0
].sha1,
+ blob[
0].name, blob[0
].name);
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
@@
-232,7
+233,7
@@
static int builtin_diff_combined(struct rev_info *revs,
return 0;
}
return 0;
}
-
static
void add_head(struct rev_info *revs)
+void add_head(struct rev_info *revs)
{
unsigned char sha1[20];
struct object *obj;
{
unsigned char sha1[20];
struct object *obj;
@@
-302,9
+303,9
@@
int cmd_diff(int argc, const char **argv, char **envp)
obj = deref_tag(obj, NULL, 0);
if (!obj)
die("invalid object '%s' given.", name);
obj = deref_tag(obj, NULL, 0);
if (!obj)
die("invalid object '%s' given.", name);
- if (
!strcmp(obj->type, commit_type)
)
+ if (
obj->type == TYPE_COMMIT
)
obj = &((struct commit *)obj)->tree->object;
obj = &((struct commit *)obj)->tree->object;
- if (
!strcmp(obj->type, tree_type)
) {
+ if (
obj->type == TYPE_TREE
) {
if (ARRAY_SIZE(ent) <= ents)
die("more than %d trees given: '%s'",
(int) ARRAY_SIZE(ent), name);
if (ARRAY_SIZE(ent) <= ents)
die("more than %d trees given: '%s'",
(int) ARRAY_SIZE(ent), name);
@@
-314,7
+315,7
@@
int cmd_diff(int argc, const char **argv, char **envp)
ents++;
continue;
}
ents++;
continue;
}
- if (
!strcmp(obj->type, blob_type)
) {
+ if (
obj->type == TYPE_BLOB
) {
if (2 <= blobs)
die("more than two blobs given: '%s'", name);
memcpy(blob[blobs].sha1, obj->sha1, 20);
if (2 <= blobs)
die("more than two blobs given: '%s'", name);
memcpy(blob[blobs].sha1, obj->sha1, 20);