From: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
To: git@vger.kernel.org
Cc: derrickstolee@github.com, vdye@github.com,
Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Subject: [RFC PATCH 1/1] mv: integrate with sparse-index
Date: Tue, 15 Mar 2022 18:01:45 +0800 [thread overview]
Message-ID: <20220315100145.214054-2-shaoxuan.yuan02@gmail.com> (raw)
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
next prev parent reply other threads:[~2022-03-15 10:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 10:01 [RFC PATCH 0/1] mv: integrate with sparse-index Shaoxuan Yuan
2022-03-15 10:01 ` Shaoxuan Yuan [this message]
2022-03-15 16:07 ` [RFC PATCH 1/1] " Victoria Dye
2022-03-15 17:14 ` Derrick Stolee
2022-03-16 3:29 ` Shaoxuan Yuan
2022-03-17 8:37 ` Shaoxuan Yuan
2022-03-16 3:18 ` Shaoxuan Yuan
2022-03-16 10:45 ` Shaoxuan Yuan
2022-03-16 13:34 ` Derrick Stolee
2022-03-16 14:46 ` Shaoxuan Yuan
2022-03-17 21:57 ` Victoria Dye
2022-03-18 1:00 ` Junio C Hamano
2022-03-21 15:20 ` Derrick Stolee
2022-03-21 19:14 ` Junio C Hamano
2022-03-21 19:45 ` Derrick Stolee
2022-03-22 8:38 ` Shaoxuan Yuan
2022-03-23 13:10 ` Derrick Stolee
2022-03-23 21:33 ` Junio C Hamano
2022-03-27 3:48 ` Shaoxuan Yuan
2022-03-28 13:32 ` Derrick Stolee
2022-03-15 17:23 ` Junio C Hamano
2022-03-15 20:00 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220315100145.214054-2-shaoxuan.yuan02@gmail.com \
--to=shaoxuan.yuan02@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=vdye@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).