libgit2 / libgit2/libgit2sharp

option to not update submodules when doing checkout

Open
#1,494 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

it seems to be a known issue that, at least when there are numerous binary files in a submodule, the submodule update process takes much longer than specifically checking out each submodule. I am, using libgit2sharp to do these checkouts, but the checkout on the superproject takes much longer (~5 sec for super vs <0.1sec for each submodule).
It looks like Commands.Checkout is, effectively, running:

git checkout [sha]
git submodule update --recursive -f

or something like it, but I just want the first line, not both. Is there some repositoryOption or CheckoutOption or something I can use to use it like this?

my usage of ligit2sharp is:

using (Repository repo =  new Repository(filePath))
{
   //logging and timing
   Commands.Checkout(
      repo,
      commit,
      new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force }
      );
   //logging and timing
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Commands.Checkout and the CheckoutOptions and CheckoutModifiers types shown in the issue, then trace where submodule updates are triggered. Verify the checkout behavior and identify how an option could suppress that update; done means a checkout can skip submodule updates while preserving the existing behavior by default, with coverage for the new option.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.