Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rev index in 2.42.0 series #600

Merged
merged 2 commits into from
Aug 29, 2023
Merged

Fix rev index in 2.42.0 series #600

merged 2 commits into from
Aug 29, 2023

Conversation

jeffhostetler
Copy link

Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*

Add test case to demonstrate that `git index-pack -o <idx-path> pack-path`
fails if <idx-path> does not end in ".idx" when `--rev-index` is
enabled.

In e37d0b8 (builtin/index-pack.c: write reverse indexes, 2021-01-25)
we learned to create `.rev` reverse indexes in addition to `.idx` index
files.  The `.rev` file pathname is constructed by replacing the suffix
on the `.idx` file.  The code assumes a hard-coded "idx" suffix.

In a8dd7e0 (config: enable `pack.writeReverseIndex` by default, 2023-04-12)
reverse indexes were enabled by default.

If the `-o <idx-path>` argument is used, the index file may have a
different suffix.  This causes an error when it tries to create the
reverse index pathname.

The test here demonstrates the failure.  (The test forces `--rev-index`
to avoid interaction with `GIT_TEST_NO_WRITE_REV_INDEX` during CI runs.)

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Teach index-pack to silently omit the reverse index if the
index file does not have the standard ".idx" suffix.

In e37d0b8 (builtin/index-pack.c: write reverse indexes, 2021-01-25)
we learned to create `.rev` reverse indexes in addition to `.idx` index
files.  The `.rev` file pathname is constructed by replacing the suffix
on the `.idx` file.  The code assumes a hard-coded "idx" suffix.

In a8dd7e0 (config: enable `pack.writeReverseIndex` by default, 2023-04-12)
reverse indexes were enabled by default.

If the `-o <idx-path>` argument is used, the index file may have a
different suffix.  This causes an error when it tries to create the
reverse index pathname.

Since we do not know why the user requested a non-standard suffix for
the index, we cannot guess what the proper corresponding suffix should
be for the reverse index.  So we disable it.

The t5300 test has been updated to verify that we no longer error
out and that the .rev file is not created.

TODO We could warn the user that we skipped it (perhaps only if they
TODO explicitly requested `--rev-index` on the command line).
TODO
TODO Ideally, we should add an `--rev-index-path=<path>` argument
TODO or change `--rev-index` to take a pathname.
TODO
TODO I'll leave these questions for a future series.

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a solid band-aid to me.

@jeffhostetler jeffhostetler merged commit dd2d7ed into vfs-2.42.0 Aug 29, 2023
81 of 82 checks passed
@jeffhostetler jeffhostetler deleted the fix-rev-index-242 branch August 29, 2023 13:25
dscho pushed a commit that referenced this pull request Nov 3, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 3, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 3, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 3, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 8, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 14, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Nov 20, 2023
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
vdye pushed a commit that referenced this pull request Feb 27, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 23, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 23, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 23, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 23, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 24, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Apr 29, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request May 14, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request May 14, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request May 14, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jun 3, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jun 3, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jun 3, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jul 17, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jul 17, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jul 17, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jul 18, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
mjcheetham pushed a commit that referenced this pull request Jul 23, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Jul 25, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
mjcheetham pushed a commit that referenced this pull request Jul 29, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Sep 18, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Sep 24, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
dscho pushed a commit that referenced this pull request Oct 8, 2024
Cherry-pick rev-index fixes from v2.41.0.vfs.0.5 into v2.42.0.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants