[PATCH] Try to resurrect the handling for 'diff-index -m'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



run_diff_index() had special handling for 'diff-index -m', which
was lost in the conversion to use unpack_trees() instead of
diff_cache().

---

Also on top of the patches of Junio and Linus.

I am not too certain about this; I just tried to reproduce what the old
code did.

 diff-lib.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/diff-lib.c b/diff-lib.c
index 7941486..27032a9 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -614,11 +614,19 @@ static int oneway_diff(struct cache_entry **src,
 		tree = NULL;
 
 	/*
+	 * Backward compatibility wart - "diff-index -m" does
+	 * not mean "do not ignore merges", but totally different.
+	 * Therefore, the "match_missing" argument is set to
+	 * "!revs->ignore_merges".
+	 */
+
+	/*
 	 * Something added to the tree?
 	 */
 	if (!tree) {
 		if (ce_path_match(idx, revs->prune_data))
-			show_new_file(revs, idx, o->index_only, 0);
+			show_new_file(revs, idx, o->index_only,
+					!revs->ignore_merges);
 		return 1;
 	}
 
@@ -627,13 +635,15 @@ static int oneway_diff(struct cache_entry **src,
 	 */
 	if (!idx) {
 		if (ce_path_match(tree, revs->prune_data))
-			diff_index_show_file(revs, "-", tree, tree->sha1, tree->ce_mode);
+			diff_index_show_file(revs, "-",
+					tree, tree->sha1, tree->ce_mode);
 		return 0;
 	}
 
 	/* Show difference between old and new */
 	if (ce_path_match(idx, revs->prune_data))
-		show_modified(revs, tree, idx, 1, o->index_only, 0);
+		show_modified(revs, tree, idx, 1, o->index_only,
+				!revs->ignore_merges);
 	return 1;
 }
 
@@ -644,14 +654,6 @@ int run_diff_index(struct rev_info *revs, int cached)
 	const char *tree_name;
 	struct unpack_trees_options opts;
 	struct tree_desc t;
-	int match_missing = 0;
-
-	/*
-	 * Backward compatibility wart - "diff-index -m" does
-	 * not mean "do not ignore merges", but totally different.
-	 */
-	if (!revs->ignore_merges)
-		match_missing = 1;
 
 	mark_merge_entries();
 
-- 
1.5.4.rc3.44.g6cd4


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux