--packv4 also sets prerequisite PACKV4, which can be used to disable
v2-specific tests. You can run the test suite with

make test GIT_TEST_OPTS=--packv4

or just a specific test

./t5300-*.sh --packv4 -v -i

Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 builtin/pack-objects.c |  4 ++++
 t/test-lib.sh          | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8e2e5e9..1e0c2e6 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2735,6 +2735,10 @@ int cmd_pack_objects(int argc, const char **argv, const 
char *prefix)
        if (!pack_compression_seen && core_compression_seen)
                pack_compression_level = core_compression_level;
 
+       /* GIT_TEST_PACKV4 does not override --version */
+       if (getenv("GIT_TEST_PACKV4"))
+               pack_version = 4;
+
        progress = isatty(2);
        argc = parse_options(argc, argv, prefix, pack_objects_options,
                             pack_usage, 0);
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1aa27bd..931dd23 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -222,6 +222,9 @@ do
        --statusprefix=*)
                statusprefix=$(expr "z$1" : 'z[^=]*=\(.*\)')
                shift ;;
+       --packv4)
+               packv4=t
+               shift ;;
        *)
                echo "error: unknown test option '$1'" >&2; exit 1 ;;
        esac
@@ -740,6 +743,13 @@ else
        mkdir -p "$TRASH_DIRECTORY"
 fi
 
+if test -n "$packv4"
+then
+       GIT_TEST_PACKV4=t
+       export GIT_TEST_PACKV4
+       test_set_prereq PACKV4
+fi
+
 # Gross hack to spawn N sub-instances of the tests in parallel, and
 # summarize the results.  Note that if this is enabled, the script
 # terminates at the end of this 'if' block.
-- 
1.8.2.83.gc99314b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to