All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH v3 0/3] "update-index --show-index-version"
Date: Tue, 12 Sep 2023 12:32:32 -0700	[thread overview]
Message-ID: <20230912193235.776292-1-gitster@pobox.com> (raw)
In-Reply-To: <20230818233729.2766281-1-gitster@pobox.com>

Even though there is "test-tool index-version", there wasn't an
officially supported way for end-users to inspect the index version
of an on-disk index.  Let's have one.

This iteration takes suggestions by Linus Arver; the tests added by
[2/3] have been clarified.

Junio C Hamano (3):
  update-index doc: v4 is OK with JGit and libgit2
  update-index: add --show-index-version
  test-tool: retire "index-version"

 Documentation/git-update-index.txt    | 14 ++++++++----
 Makefile                              |  1 -
 builtin/update-index.c                | 19 ++++++++++------
 t/helper/test-index-version.c         | 15 -------------
 t/helper/test-tool.c                  |  1 -
 t/helper/test-tool.h                  |  1 -
 t/t1600-index.sh                      |  2 +-
 t/t1700-split-index.sh                |  2 +-
 t/t2104-update-index-skip-worktree.sh |  6 +++---
 t/t2107-update-index-basic.sh         | 31 +++++++++++++++++++++++++++
 10 files changed, 59 insertions(+), 33 deletions(-)
 delete mode 100644 t/helper/test-index-version.c

Range-diff against v2:
1:  7bc7f7877d ! 1:  224a72529a update-index doc: v4 is OK with JGit and libgit2
    @@ Commit message
         cautious about cross-tool compatibility.
     
         Helped-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
    +    Helped-by: Linus Arver <linusa@google.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
      ## Documentation/git-update-index.txt ##
    @@ Documentation/git-update-index.txt: you will need to handle the situation manual
     -may not support it yet.
     +time.  Git supports it since version 1.8.0, released in October 2012,
     +and support for it was added to libgit2 in 2016 and to JGit in 2020.
    -+Older editions of this manual page called it "relatively young", but
    ++Older versions of this manual page called it "relatively young", but
     +it should be considered mature technology these days.
     +
      
2:  33c924f893 ! 2:  bd3fc76b3f update-index: add --show-index-version
    @@ Metadata
      ## Commit message ##
         update-index: add --show-index-version
     
    -    "git update-index --version N" is used to set the index format
    +    "git update-index --index-version N" is used to set the index format
         version to a specific version, but there was no way to query the
         current version used in the on-disk index file.
     
    @@ Commit message
         teach the "--index-version N" option to report what the version was
         when run with the "--verbose" option.
     
    +    Helped-by: Linus Arver <linusa@google.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
      ## Documentation/git-update-index.txt ##
    @@ Documentation/git-update-index.txt: you will need to handle the situation manual
      	Supported versions are 2, 3 and 4. The current default version is 2
      	or 3, depending on whether extra features are used, such as
     -	`git add -N`.
    -+	`git add -N`.  With `--verbose` option, also reports the
    -+	version the index file uses before and after this command.
    ++	`git add -N`.  With `--verbose`, also report the version the index
    ++	file uses before and after this command.
      +
      Version 4 performs a simple pathname compression that reduces index
      size by 30%-50% on large repositories, which results in faster load
     @@ Documentation/git-update-index.txt: and support for it was added to libgit2 in 2016 and to JGit in 2020.
    - Older editions of this manual page called it "relatively young", but
    + Older versions of this manual page called it "relatively young", but
      it should be considered mature technology these days.
      
     +--show-index-version::
    @@ builtin/update-index.c: int cmd_update_index(int argc, const char **argv, const
      		OPT_INTEGER(0, "index-version", &preferred_index_format,
      			N_("write index in this format")),
     +		OPT_SET_INT(0, "show-index-version", &preferred_index_format,
    -+			    N_("show index format version"), -1),
    ++			    N_("report on-disk index format version"), -1),
      		OPT_BOOL(0, "split-index", &split_index,
      			N_("enable or disable split index")),
      		OPT_BOOL(0, "untracked-cache", &untracked_cache,
    @@ t/t2107-update-index-basic.sh: test_expect_success '--chmod=+x and chmod=-x in t
     +test_expect_success '--index-version' '
     +	git commit --allow-empty -m snap &&
     +	git reset --hard &&
    ++	git rm -f -r --cached . &&
     +
    -+	git update-index --index-version 2 >actual &&
    -+	test_must_be_empty actual &&
    -+
    ++	# The default index version is 2 --- update this test
    ++	# when you change it in the code
     +	git update-index --show-index-version >actual &&
     +	echo 2 >expect &&
     +	test_cmp expect actual &&
     +
    ++	# The next test wants us to be using version 2
    ++	git update-index --index-version 2 &&
    ++
     +	git update-index --index-version 4 --verbose >actual &&
     +	echo "index-version: was 2, set to 4" >expect &&
    -+	test_cmp expect actual
    ++	test_cmp expect actual &&
    ++
    ++	git update-index --index-version 4 --verbose >actual &&
    ++	echo "index-version: was 4, set to 4" >expect &&
    ++	test_cmp expect actual &&
    ++
    ++	git update-index --index-version 2 --verbose >actual &&
    ++	echo "index-version: was 4, set to 2" >expect &&
    ++	test_cmp expect actual &&
    ++
    ++	# non-verbose should be silent
    ++	git update-index --index-version 4 >actual &&
    ++	test_must_be_empty actual
     +'
     +
      test_done
3:  137ec82973 ! 3:  d1144a8240 test-tool: retire "index-version"
    @@ Commit message
         test-tool: retire "index-version"
     
         As "git update-index --show-index-version" can do the same thing,
    -    the test-tool lost its reason to exist.
    +    the 'index-version' subcommand in the test-tool lost its reason to
    +    exist.  Remove it and replace its use with the end-user facing
    +    'git update-index --show-index-version'.
     
    +    Helped-by: Linus Arver <linusa@google.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
      ## Makefile ##
-- 
2.42.0-158-g94e83dcf5b


  parent reply	other threads:[~2023-09-12 19:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 23:37 [PATCH v2 0/3] "update-index --show-index-version" Junio C Hamano
2023-08-18 23:37 ` [PATCH v2 1/3] update-index doc: v4 is OK with JGit and libgit2 Junio C Hamano
2023-09-12  4:57   ` Linus Arver
2023-09-12 17:14     ` Junio C Hamano
2023-08-18 23:37 ` [PATCH v2 2/3] update-index: add --show-index-version Junio C Hamano
2023-09-12  5:54   ` Linus Arver
2023-09-12 19:01     ` Junio C Hamano
2023-08-18 23:37 ` [PATCH v2 3/3] test-tool: retire "index-version" Junio C Hamano
2023-09-12  6:10   ` Linus Arver
2023-09-12 19:32 ` Junio C Hamano [this message]
2023-09-12 19:32   ` [PATCH v3 1/3] update-index doc: v4 is OK with JGit and libgit2 Junio C Hamano
2023-09-12 19:32   ` [PATCH v3 2/3] update-index: add --show-index-version Junio C Hamano
2023-11-14  2:18     ` Teng Long
2023-11-14  2:55       ` Junio C Hamano
2023-09-12 19:32   ` [PATCH v3 3/3] test-tool: retire "index-version" Junio C Hamano
2023-09-14  6:19   ` [PATCH v3 0/3] "update-index --show-index-version" Linus Arver
2023-09-14 18:15     ` Junio C Hamano

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=20230912193235.776292-1-gitster@pobox.com \
    --to=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.