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 degraded performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled #6

Closed
wants to merge 417 commits into from
Closed

Fix degraded performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled #6

wants to merge 417 commits into from

Conversation

julianmesa-gitkraken
Copy link

@julianmesa-gitkraken julianmesa-gitkraken commented May 12, 2022

Fix degrade performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled.
We just mimic the GIT_USE_NSEC disabled behavior when nanoseconds are 0.
There is a edge case when nanoseconds is 0 in a repo cloned with GIT_USE_NSEC enabled, never found it but anyway that file will be handle fine just the sha1 will be generated to check if has changed.

Enabling GIT_USE_NSEC we will get a boost performance in LFS repos using long running process filter.
Using long running process filter the LFS files and the index will have similar timestamp, the only difference is nanoseconds, if you execute git_status_list_new withouth GIT_USE_NSEC then the clean filter will triggered because the seconds are the same in LFS files and index because of the batch mode ("git lfs checkout")

ethomson and others added 30 commits January 6, 2022 07:42
Push starts by connecting, don't try to connect again, just rely on the
existing connection existing.
Several places in the remote code identify an error and then swallow it;
return the error.
The existing mechanism for providing options to remote fetch/push calls,
and subsequently to transports, is unsatisfactory.  It requires an
options structure to avoid breaking the API and callback signatures.

1. Introduce `git_remote_connect_options` to satisfy those needs.

2. Add a new remote connection API, `git_remote_connect_ext` that will
   take this new options structure.  Existing `git_remote_connect` calls
   will proxy to that.  `git_remote_fetch` and `git_remote_push` will
   proxy their fetch/push options to that as well.

3. Define the interaction between `git_remote_connect` and fetch/push.
   Connect _may_ be called before fetch/push, but _need not_ be.  The
   semantics of which options would be used for these operations was
   not specified if you specify options for both connect _and_ fetch.
   Now these are defined that the fetch or push options will be used
   _if_ they were specified.  Otherwise, the connect options will be
   used if they were specified.  Otherwise, the library's defaults will
   be used.

4. Update the transports to understand `git_remote_connect_options`.
   This is a breaking change to the systems API.
The new version of our test git server adds redirect support.  Upgrade
to it.
We (thankfully) don't have flaky tests anymore, don't retry them.
In redirect application logic, (optionally) allow off-site redirects.
Give callers the ability to select how to handle redirects - either
supporting redirects during the initial connection (so that, for
example, `git.example.com/repo` can redirect to `github.com/example/repo`)
or all/no redirects.  This is for compatibility with git.
Test that we honor `http.followRedirects` when set to initial or false.
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
Co-authored-by: Edward Thomson <[email protected]>
ethomson and others added 25 commits April 10, 2022 15:56
Now that oids are type-aware, they use their type to understand how many
bytes to copy.  Some callers may need to copy the raw bytes of the
object id.

This is equivalent to a memcpy that is a little more semantic.
The commit graph contains arrays of raw oid data, use a byte array to
index into them.
A packfile contains arrays of raw oid data, use a byte array to index
into them.
The index contains entries with raw oid data, use a byte array for the
raw entry data.
A multi-pack index uses raw oid data, use a byte array to index
into them.
The indexer expects raw oid data, provide it.
Provide individual file ownership checks for both the current user and
the system user, as well as a combined current user and system user
check.
Ensure that the repository directory is owned by the current user; this
prevents us from opening configuration files that may have been created
by an attacker.
Provide a mock for file ownership for testability.
Test that we prevent opening directories that are not owned by
ourselves.
Pull the global configuration loader out of the symlink check so that it
can be re-used.
Obey the `safe.directory` configuration variable if it is set in the
global or system configuration. (Do not try to load this from the
repository configuration - to avoid malicious repositories that then
mark themselves as safe.)
Introduce the `GIT_OPT_SET_OWNER_VALIDATION` option, so that users can
disable repository ownership validation.
Validate repository directory ownership
Provide a class that will display progress information to the console.
Initially, it contains callbacks for fetch progress and checkout
progress.
Provide a mechanism to add a signal handler for Unix or Win32.
6fc6eeb replaced the remote options
with `git_remote_connect_options`. The function definitions were
removed, but one function declaration remained, causing linker errors if
one tried to use it.

This change removes the declaration of
`git_transport_smart_proxy_option` to better reflect reality.
sha256: refactoring in preparation for sha256
…art_proxy_options

remote: Delete a now-inexistent API declaration
The dates we use in `refs::revparse::date` has just passed the ten years, so
now everything is beyond ten years, leading to an unexpected commit being
returned.

Adjust it to 11 years so it all looks fine again.
@julianmesa-gitkraken julianmesa-gitkraken changed the title Fix degrade performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled Fix degraded performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled May 12, 2022
zawata pushed a commit to zawata/libgit2 that referenced this pull request Feb 7, 2024
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.