git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/5] diff-index: report unmerged new entries

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2009, 09:15 UTC
Message-ID
<1249463746-21538-2-git-send-email-gitster@pobox.com>
In-Reply-To
<1249463746-21538-1-git-send-email-gitster@pobox.com>

Since an earlier change to diff-index by d1f2d7e (Make run_diff_index() use unpack_trees(), not read_tree(), 2008-01-19), we stopped reporting an unmerged path that does not exist in the tree, but we should.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff-lib.c          |    4 ++--
 t/t7060-wtstatus.sh |   31 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100755 t/t7060-wtstatus.sh
diff --git a/diff-lib.c b/diff-lib.c
index ad2a4cd..ad5b6ca 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -348,8 +348,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
 	match_missing = !revs->ignore_merges;
 
 	if (cached && idx && ce_stage(idx)) {
-		if (tree)
-			diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode, idx->sha1);
+		diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode,
+			     idx->sha1);
 		return;
 	}
 
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
new file mode 100755
index 0000000..5ad2cd1
--- /dev/null
+++ b/t/t7060-wtstatus.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+test_description='basic work tree status reporting'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+	test_commit A &&
+	test_commit B oneside added &&
+	git checkout A^0 &&
+	test_commit C oneside created
+'
+
+test_expect_success 'A/A conflict' '
+	git checkout B^0 &&
+	test_must_fail git merge C
+'
+
+test_expect_success 'Report path with conflict' '
+	git diff --cached --name-status >actual &&
+	echo "U	oneside" >expect &&
+	test_cmp expect actual
+'
+
+test_expect_success 'Report new path with conflict' '
+	git diff --cached --name-status HEAD^ >actual &&
+	echo "U	oneside" >expect &&
+	test_cmp expect actual
+'
+
+test_done
-- 
1.6.4.18.g07a4a
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 22 in “Revamping "git status"”
  1. 0/5 Revamping "git status"Junio C Hamano, Aug 5, 2009
  2. 1/5 diff-index: report unmerged new entriesJunio C Hamano, Aug 5, 2009
  3. 2/5 diff-index: keep the original index intactJunio C Hamano, Aug 5, 2009
  4. 3/5 wt-status.c: rework the way changes to the index and work tree are summarizedJunio C Hamano, Aug 5, 2009
  5. 4/5 status: show worktree status of conflicted paths separatelyJunio C Hamano, Aug 5, 2009
  6. 5/5 shortstatus: a new commandJunio C Hamano, Aug 5, 2009
  7. Jeff KingAug 6, 2009
  8. Breaking "git status" (was Re: [PATCH 5/5] shortstatus: a new command)Junio C Hamano, Aug 6, 2009
  9. Jeff KingAug 6, 2009
  10. Junio C HamanoAug 6, 2009
  11. Sverre RabbelierAug 6, 2009
  12. Jeff KingAug 6, 2009
  13. Jeff KingAug 6, 2009
  14. Junio C HamanoAug 6, 2009
  15. Thomas RastAug 5, 2009
  16. Junio C HamanoAug 5, 2009
  17. Thomas RastAug 5, 2009
  18. Thomas RastAug 5, 2009
  19. Junio C HamanoAug 5, 2009
  20. Thomas RastAug 5, 2009
  21. Junio C HamanoAug 5, 2009
  22. Thomas RastAug 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.