git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Meet Soni <meetsoni3017@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, shejialuo@gmail.com, Meet Soni <meetsoni3017@gmail.com>
Subject: [GSoC][PATCH 5/5] t: add test for git refs optimize subcommand
Date: Tue, 26 Aug 2025 13:06:45 +0530	[thread overview]
Message-ID: <20250826073645.1074397-6-meetsoni3017@gmail.com> (raw)
In-Reply-To: <20250826073645.1074397-1-meetsoni3017@gmail.com>

Add a test script, `t/t1463-refs-optimize.sh`, for the new `git refs
optimize` command.

This script acts as a simple driver, leveraging the shared test library
created in the preceding commit. It works by overriding the
`$pack_refs` variable to "refs optimize" and then sourcing the
shared library (`t/pack-refs-tests.sh`).

This approach ensures that `git refs optimize` is tested against the
entire comprehensive test suite of `git pack-refs`, verifying
that it acts as a compatible drop-in replacement.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
---
 t/meson.build            |  3 ++-
 t/t1463-refs-optimize.sh | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100755 t/t1463-refs-optimize.sh

diff --git a/t/meson.build b/t/meson.build
index daf01fb5d0..48f83e12a7 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -210,6 +210,7 @@ integration_tests = [
   't1451-fsck-buffer.sh',
   't1460-refs-migrate.sh',
   't1461-refs-list.sh',
+  't1463-refs-optimize.sh',
   't1500-rev-parse.sh',
   't1501-work-tree.sh',
   't1502-rev-parse-parseopt.sh',
@@ -1216,4 +1217,4 @@ if perl.found() and time.found()
       timeout: 0,
     )
   endforeach
-endif
\ No newline at end of file
+endif
diff --git a/t/t1463-refs-optimize.sh b/t/t1463-refs-optimize.sh
new file mode 100755
index 0000000000..c11c905d79
--- /dev/null
+++ b/t/t1463-refs-optimize.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+test_description='git refs optimize should not change the branch semantic
+
+This test runs git refs optimize and git show-ref and checks that the branch
+semantic is still the same.
+'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+GIT_TEST_DEFAULT_REF_FORMAT=files
+export GIT_TEST_DEFAULT_REF_FORMAT
+
+. ./test-lib.sh
+
+pack_refs='refs optimize'
+. "$TEST_DIRECTORY"/pack-refs-tests.sh
-- 
2.34.1


  parent reply	other threads:[~2025-08-26  7:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  7:36 [GSoC][PATCH 0/5] Add refs optimize subcommand Meet Soni
2025-08-26  7:36 ` [GSoC][PATCH 1/5] builtin/pack-refs: factor out core logic into a helper Meet Soni
2025-09-02 10:18   ` Patrick Steinhardt
2025-09-03  3:56     ` Meet Soni
2025-09-03  4:37       ` Patrick Steinhardt
2025-09-03  5:25     ` Junio C Hamano
2025-09-03  6:00       ` Patrick Steinhardt
2025-09-03 18:20         ` Junio C Hamano
2025-08-26  7:36 ` [GSoC][PATCH 2/5] doc: factor out common option Meet Soni
2025-08-26  7:36 ` [GSoC][PATCH 3/5] builtin/refs: add optimize subcommand Meet Soni
2025-09-02 10:18   ` Patrick Steinhardt
2025-08-26  7:36 ` [GSoC][PATCH 4/5] t0601: refactor tests to be shareable Meet Soni
2025-08-26  7:36 ` Meet Soni [this message]
2025-08-26 15:18   ` [GSoC][PATCH 5/5] t: add test for git refs optimize subcommand shejialuo
2025-08-31  6:20     ` Meet Soni
2025-09-02 10:18   ` Patrick Steinhardt
2025-09-03  3:58     ` Meet Soni

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=20250826073645.1074397-6-meetsoni3017@gmail.com \
    --to=meetsoni3017@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=shejialuo@gmail.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).