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

[RFC PATCH 1/1] mv: integrate with sparse-index

From
Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Date
Mar 15, 2022, 10:01 UTC
Message-ID
<20220315100145.214054-2-shaoxuan.yuan02@gmail.com>
In-Reply-To
<20220315100145.214054-1-shaoxuan.yuan02@gmail.com>
Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
---
 builtin/mv.c                             |  3 +++
 t/t1092-sparse-checkout-compatibility.sh | 34 ++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
diff --git a/builtin/mv.c b/builtin/mv.c
index 83a465ba83..111360ebf5 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -138,6 +138,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 	git_config(git_default_config, NULL);
 
+	prepare_repo_settings(the_repository);
+	the_repository->settings.command_requires_full_index = 0;
+
 	argc = parse_options(argc, argv, prefix, builtin_mv_options,
 			     builtin_mv_usage, 0);
 	if (--argc < 1)
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 2a04b532f9..0a8164c5f6 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -1521,4 +1521,38 @@ test_expect_success 'checkout behaves oddly with df-conflict-2' '
 	test_cmp full-checkout-err sparse-index-err
 '
 
+test_expect_success 'mv' '
+	init_repos &&
+
+	# test first form <source> <destination>
+	test_all_match git mv deep/a deep/a_mod &&
+	test_all_match git mv deep/deeper1 deep/deeper1_mod &&
+	test_all_match git mv deep/deeper2/deeper1/deepest2/a \
+	deep/deeper2/deeper1/deepest2/a_mod &&
+
+	run_on_all git reset --hard &&
+
+	test_all_match git mv -f deep/a deep/before/a &&
+	test_all_match git mv -f deep/before/a deep/a &&
+
+	run_on_all git reset --hard &&
+
+	test_all_match git mv -k deep/a deep/before/a &&
+	test_all_match git mv -k deep/before/a deep/a &&
+
+	run_on_all git reset --hard &&
+
+	test_all_match git mv -v deep/a deep/a_mod &&
+	test_all_match git mv -v deep/deeper1 deep/deeper1_mod &&
+	test_all_match git mv -v deep/deeper2/deeper1/deepest2/a \
+	deep/deeper2/deeper1/deepest2/a_mod &&
+
+	# test second form <source> ... <destination directory>
+	run_on_all git reset --hard &&
+	run_on_all mkdir deep/folder &&
+	test_all_match git mv deep/a deep/folder &&
+	test_all_match git mv -v deep/deeper1 deep/folder &&
+	test_all_match git mv -f deep/deeper2/deeper1/deepest2/a deep/folder
+'
+
 test_done
-- 
2.35.1
Previous: Shaoxuan YuanNext: Victoria Dye
Message 2 of 22 in “mv: integrate with sparse-index”
  1. 0/1 mv: integrate with sparse-indexShaoxuan Yuan, Mar 15, 2022
  2. 1/1 mv: integrate with sparse-indexShaoxuan Yuan, Mar 15, 2022
  3. Victoria DyeMar 15, 2022
  4. Derrick StoleeMar 15, 2022
  5. Shaoxuan YuanMar 16, 2022
  6. Shaoxuan YuanMar 17, 2022
  7. Shaoxuan YuanMar 16, 2022
  8. Shaoxuan YuanMar 16, 2022
  9. Derrick StoleeMar 16, 2022
  10. Shaoxuan YuanMar 16, 2022
  11. Victoria DyeMar 17, 2022
  12. Junio C HamanoMar 18, 2022
  13. Derrick StoleeMar 21, 2022
  14. Junio C HamanoMar 21, 2022
  15. Derrick StoleeMar 21, 2022
  16. Shaoxuan YuanMar 22, 2022
  17. Derrick StoleeMar 23, 2022
  18. Junio C HamanoMar 23, 2022
  19. Shaoxuan YuanMar 27, 2022
  20. Derrick StoleeMar 28, 2022
  21. Junio C HamanoMar 15, 2022
  22. Derrick StoleeMar 15, 2022

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.