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

[PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file

From
Jaime Soriano Pastor <jsorianopastor@gmail.com>
Date
Aug 20, 2014, 11:26 UTC
Message-ID
<7782c581021d529947a1385939231eeb145d150e.1408533065.git.jsorianopastor@gmail.com>
In-Reply-To
<cover.1408533065.git.jsorianopastor@gmail.com>
Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
---
 t/t9904-unmerged-file-with-merged-entry.sh | 86 ++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 t/t9904-unmerged-file-with-merged-entry.sh
diff --git a/t/t9904-unmerged-file-with-merged-entry.sh b/t/t9904-unmerged-file-with-merged-entry.sh
new file mode 100755
index 0000000..945bc1c
--- /dev/null
+++ b/t/t9904-unmerged-file-with-merged-entry.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+test_description='Operations with unmerged files with merged entries'
+
+. ./test-lib.sh
+
+setup_repository() {
+	test_commit A conflict A
+	test_commit A conflict2 A2 branchbase
+	test_commit B conflict B
+	test_commit B conflict2 B2
+	git checkout branchbase -b branch1
+	test_commit C conflict C
+	test_commit C conflict2 C2
+	test_commit something otherfile otherfile
+}
+
+setup_stage_state() {
+	git checkout -f HEAD
+	{
+		git ls-files -s conflict conflict2
+		git merge master > /dev/null
+		git ls-files -s conflict conflict2
+	} > index
+	cat index | git update-index --index-info
+	rm index
+}
+
+test_expect_success 'setup - two branches with conflicting files' '
+	setup_repository &&
+	setup_stage_state &&
+	git ls-files -s conflict > output &&
+	test_line_count = 4 output &&
+	git ls-files -s conflict2 > output &&
+	test_line_count = 4 output &&
+	rm output
+'
+
+test_expect_success 'git commit -a' '
+	setup_stage_state &&
+	test_must_fail git commit -a
+'
+
+test_expect_success 'git add conflict' '
+	setup_stage_state &&
+	test_must_fail git add conflict
+'
+
+test_expect_success 'git rm conflict' '
+	setup_stage_state &&
+	test_must_fail git rm conflict
+'
+
+test_expect_success 'git add otherfile' '
+	setup_stage_state &&
+	>otherfile &&
+	git add otherfile
+'
+
+test_expect_success 'git rm otherfile' '
+	setup_stage_state &&
+	git rm otherfile
+'
+
+test_expect_success 'git add newfile' '
+	setup_stage_state &&
+	>newfile &&
+	git add newfile
+'
+
+test_expect_success 'git merge branch' '
+	setup_stage_state &&
+	test_must_fail git merge master
+'
+
+test_expect_success 'git reset --hard' '
+	setup_stage_state &&
+	git reset --hard &&
+	git show HEAD:conflict > expected &&
+	cat conflict > current &&
+	git show HEAD:conflict2 > expected &&
+	cat conflict2 > current &&
+	test_cmp expected current
+'
+
+test_done
-- 
2.0.4.4.gaf54b2b
Previous: Jaime Soriano PastorNext: Junio C Hamano
Message 14 of 51 in “read-cache.c: Ensure unmerged entries are removed”
  1. read-cache.c: Ensure unmerged entries are removedJaime Soriano Pastor, Aug 12, 2014
  2. read-cache.c: Ensure unmerged entries are removedJaime Soriano Pastor, Aug 12, 2014
  3. Junio C HamanoAug 12, 2014
  4. Jaime Soriano PastorAug 13, 2014
  5. Junio C HamanoAug 13, 2014
  6. Jaime Soriano PastorAug 15, 2014
  7. Junio C HamanoAug 15, 2014
  8. Jaime Soriano PastorAug 16, 2014
  9. Junio C HamanoAug 18, 2014
  10. Jaime Soriano PastorAug 18, 2014
  11. 0/4 Handling unmerged files with merged entriesJaime Soriano Pastor, Aug 20, 2014
  12. 1/4 read_index_unmerged doesn't loop forever if merged stage exists for unmerged fileJaime Soriano Pastor, Aug 20, 2014
  13. 2/4 Error out when adding a file with merged and unmerged entriesJaime Soriano Pastor, Aug 20, 2014
  14. 3/4 Added tests for the case of merged and unmerged entries for the same fileJaime Soriano Pastor, Aug 20, 2014
  15. Junio C HamanoAug 20, 2014
  16. Jaime Soriano PastorAug 21, 2014
  17. Junio C HamanoAug 21, 2014
  18. 4/4 git update-index --cacheinfo can be used to select a stage when there are merged and unmerged entriesJaime Soriano Pastor, Aug 20, 2014
  19. Junio C HamanoAug 20, 2014
  20. Jaime Soriano PastorAug 21, 2014
  21. Junio C HamanoAug 20, 2014
  22. Jaime Soriano PastorAug 21, 2014
  23. Check order when reading indexJaime Soriano Pastor, Aug 21, 2014
  24. Jaime Soriano PastorAug 21, 2014
  25. Duy NguyenAug 21, 2014
  26. Junio C HamanoAug 21, 2014
  27. 1/2 Check order when reading indexJaime Soriano Pastor, Aug 24, 2014
  28. 2/2 Loop index increases monotonically when reading unmerged entriesJaime Soriano Pastor, Aug 24, 2014
  29. Jaime Soriano PastorAug 24, 2014
  30. Junio C HamanoAug 25, 2014
  31. Junio C HamanoAug 25, 2014
  32. Jeff KingAug 25, 2014
  33. Junio C HamanoAug 25, 2014
  34. Jaime Soriano PastorAug 26, 2014
  35. Jeff KingAug 26, 2014
  36. Junio C HamanoAug 26, 2014
  37. Jaime Soriano PastorAug 26, 2014
  38. Junio C HamanoAug 26, 2014
  39. 1/2 read_index_from(): catch out of order entries when reading an index fileJaime Soriano Pastor, Aug 27, 2014
  40. 2/2 read_index_unmerged(): remove unnecessary loop index adjustmentJaime Soriano Pastor, Aug 27, 2014
  41. Eric SunshineAug 29, 2014
  42. read_index_from(): catch out of order entries when reading an index fileJaime Soriano Pastor, Aug 29, 2014
  43. Junio C HamanoAug 29, 2014
  44. Jaime Soriano PastorAug 27, 2014
  45. Junio C HamanoAug 27, 2014
  46. Jaime Soriano PastorAug 27, 2014
  47. Jaime Soriano PastorAug 25, 2014
  48. Johannes SixtAug 21, 2014
  49. Junio C HamanoAug 21, 2014
  50. Junio C HamanoAug 12, 2014
  51. Jaime Soriano PastorAug 13, 2014

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.