Thanks to visit codestin.com
Credit goes to github.com

Skip to content

midx: Add a way to write multi-pack-index files #5404

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

Merged
merged 3 commits into from
Aug 30, 2021

Conversation

lhchavez
Copy link
Contributor

@lhchavez lhchavez commented Feb 18, 2020

This change adds the git_midx_writer_* functions to allow to
write and create multi-pack-index files from .idx/.pack files.

Part of: #5399

@lhchavez lhchavez force-pushed the multi-pack-index-write branch 4 times, most recently from cf16115 to 9c99c4d Compare March 1, 2020 04:32
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 9c99c4d to 4cec6b3 Compare October 5, 2020 13:29
@lhchavez lhchavez changed the title multipack: Add a way to write multi-pack-index files midx: Add a way to write multi-pack-index files Oct 5, 2020
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 4cec6b3 to 263a714 Compare November 27, 2020 13:17
@ethomson
Copy link
Member

I'm surprised that we write the midx to a git_buf and then write the git_buf to disk. I expected us to not use an intermediate git_buf. How big is a midx file going to be?

@lhchavez
Copy link
Contributor Author

lhchavez commented Dec 13, 2020

I'm surprised that we write the midx to a git_buf and then write the git_buf to disk. I expected us to not use an intermediate git_buf. How big is a midx file going to be?

as large as all the .pack files in a repo combined (my copy of linux' is 1G).

IIRC I did that for simplicity, but i can refactor things so that git_midx_writer_dump and git_midx_writer_commit both call the same function that creates the midx and call a write_cb(const char *buf, size_t size, void *payload) to avoid that extra in-memory copy.

@ethomson
Copy link
Member

IIRC I did that for simplicity, but i can refactor things so that git_midx_writer_dump and git_midx_writer_commit both call the same function that creates the midx and call a write_cb(const char *buf, size_t size, void *payload) to avoid that extra in-memory copy.

I think that would be nice if you could - I think that midx is going to be used in large repositories, so avoiding that malloc of a contiguous hunk of memory to store the data would be a win.

@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 263a714 to 2ea0ae4 Compare December 13, 2020 15:02
@lhchavez
Copy link
Contributor Author

IIRC I did that for simplicity, but i can refactor things so that git_midx_writer_dump and git_midx_writer_commit both call the same function that creates the midx and call a write_cb(const char *buf, size_t size, void *payload) to avoid that extra in-memory copy.

I think that would be nice if you could - I think that midx is going to be used in large repositories, so avoiding that malloc of a contiguous hunk of memory to store the data would be a win.

refactored and rebased!

Base automatically changed from master to main January 7, 2021 10:09
This change adds the git_midx_writer_* functions to allow to
write and create `multi-pack-index` files from `.idx`/`.pack` files.

Part of: libgit2#5399
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 2ea0ae4 to fff209c Compare July 27, 2021 01:49
Copy link
Member

@ethomson ethomson left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of questions and a couple of minor requests.

@ethomson ethomson merged commit 78cd762 into libgit2:main Aug 30, 2021
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.

2 participants