diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-14 17:51:02 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-14 17:51:02 -0800 |
commit | 756e3ee0c62b44bd700ffb2d58c371b45ea4598e (patch) | |
tree | 132be7871bba8e865aa4ae1a5f7632ddc002dc6d /combine-diff.c | |
parent | 9b6c66e05cc26cc5f688b0e700ee0cb151fc6c09 (diff) | |
parent | bba319b5cecacaccef85ce3c4cf9e3593532e328 (diff) | |
download | git-756e3ee0c62b44bd700ffb2d58c371b45ea4598e.tar.gz |
Merge branch 'jc/commit'
* jc/commit:
commit: detect misspelled pathspec while making a partial commit.
combine-diff: diff-files fix (#2)
combine-diff: diff-files fix.
Diffstat (limited to 'combine-diff.c')
-rw-r--r-- | combine-diff.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/combine-diff.c b/combine-diff.c index a38f01b13c..d812600d11 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -630,9 +630,10 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, int i, show_hunks, shown_header = 0; char ourtmp_buf[TMPPATHLEN]; char *ourtmp = ourtmp_buf; + int working_tree_file = !memcmp(elem->sha1, null_sha1, 20); /* Read the result of merge first */ - if (memcmp(elem->sha1, null_sha1, 20)) { + if (!working_tree_file) { result = grab_blob(elem->sha1, &size); write_to_temp_file(ourtmp, result, size); } @@ -646,6 +647,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, int len = st.st_size; int cnt = 0; + elem->mode = DIFF_FILE_CANON_MODE(st.st_mode); size = len; result = xmalloc(len + 1); while (cnt < len) { @@ -661,6 +663,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, else { /* deleted file */ size = 0; + elem->mode = 0; result = xmalloc(1); result[0] = 0; ourtmp = "/dev/null"; @@ -716,7 +719,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, show_hunks = make_hunks(sline, cnt, num_parent, dense); - if (show_hunks || mode_differs) { + if (show_hunks || mode_differs || working_tree_file) { const char *abb; if (header) { @@ -731,8 +734,6 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, putchar('\n'); printf("index "); for (i = 0; i < num_parent; i++) { - if (elem->parent[i].mode != elem->mode) - mode_differs = 1; abb = find_unique_abbrev(elem->parent[i].sha1, DEFAULT_ABBREV); printf("%s%s", i ? "," : "", abb); |