git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuqi Liang <cheskaqiqi@gmail.com>
To: git@vger.kernel.org
Cc: Shuqi Liang <cheskaqiqi@gmail.com>
Subject: [RFC PATCH 1/1] check-attr: integrate with sparse-index
Date: Mon, 27 Feb 2023 00:05:43 -0500	[thread overview]
Message-ID: <20230227050543.218294-2-cheskaqiqi@gmail.com> (raw)
In-Reply-To: <20230227050543.218294-1-cheskaqiqi@gmail.com>

Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
---
 builtin/check-attr.c                     |  3 +++
 t/t1092-sparse-checkout-compatibility.sh | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index 0fef10eb6b..f85b91ebba 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -112,6 +112,9 @@ int cmd_check_attr(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, check_attr_options,
 			     check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
 
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 801919009e..b28010aa5c 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -2055,4 +2055,23 @@ test_expect_success 'grep sparse directory within submodules' '
 	test_cmp actual expect
 '
 
+test_expect_success 'check-attr pathspec inside sparse definition' '
+	init_repos &&
+
+	run_on_all touch deep/test.c &&
+	echo "*.c diff=cpp -crlf myAttr" >>.gitattributes &&
+	run_on_all cp ../.gitattributes . &&
+	test_all_match git add .gitattributes &&
+	test_all_match git commit -m "add .gitattributes" &&
+	
+	run_on_all git reset --hard &&
+	test_all_match echo "deep/test.c" | git check-attr --stdin  -a &&
+
+	run_on_all git reset --hard &&
+	test_all_match git check-attr -a  deep/test.c &&
+
+	run_on_all git reset --hard &&
+	test_all_match git check-attr -a  --cached deep/test.c 
+'
+
 test_done
-- 
2.39.0


  reply	other threads:[~2023-02-27  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  5:05 [RFC PATCH 0/1] check-attr: integrate with sparse-index Shuqi Liang
2023-02-27  5:05 ` Shuqi Liang [this message]
2023-02-27 17:18   ` [RFC PATCH 1/1] " Victoria Dye
2023-02-27 17:57     ` Derrick Stolee
2023-02-27 18:51       ` Junio C Hamano
2023-02-28 18:10       ` Shuqi Liang
2023-02-27 17:18 ` [RFC PATCH 0/1] " Victoria Dye

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=20230227050543.218294-2-cheskaqiqi@gmail.com \
    --to=cheskaqiqi@gmail.com \
    --cc=git@vger.kernel.org \
    /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).