Skip to content

Prepare for vanilla Git repos#272

Merged
derrickstolee merged 12 commits intomicrosoft:masterfrom
derrickstolee:pre-vanilla
Jan 2, 2020
Merged

Prepare for vanilla Git repos#272
derrickstolee merged 12 commits intomicrosoft:masterfrom
derrickstolee:pre-vanilla

Conversation

@derrickstolee
Copy link
Copy Markdown
Contributor

@derrickstolee derrickstolee commented Dec 31, 2019

These commits are cherry-picked from #258 with slight modifications. The functionality here makes sense for repos cloned by Scalar, allowing us to focus later on the interactions with vanilla Git repos.

  1. Add ConfigStep for running the Git config commands at clone time and as the service starts up. This already has some split for vanilla Git repos, but that code does not get exercised. Resolves Create a config maintenance step #252.
  2. The PackfileMaintenanceStep attempts to repack all but the largest pack when those packs sum to less than 2gb.
  3. Some cleanup things here and there.
  4. scalar repos (add|list) allows tracking the registered repos. Resolves some of Add a verb for manually registering/unregistering repos #214.

derrickstolee and others added 3 commits December 31, 2019 08:48
Signed-off-by: Derrick Stolee <stolee@gmail.com>
When we run functional tests inside the Scalar source code, we
need our vanilla Git repos to be recognized inside that repo. The
old logic would look for "src/.git" first, finding the Scalar repo
before looking just for ".git". This makes the code simpler, too!

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee derrickstolee reopened this Dec 31, 2019
@microsoft microsoft deleted a comment from azure-pipelines bot Jan 1, 2020
@microsoft microsoft deleted a comment from azure-pipelines bot Jan 1, 2020
derrickstolee and others added 9 commits January 2, 2020 09:17
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee derrickstolee added this to the EA milestone Jan 2, 2020
@derrickstolee derrickstolee merged commit 6c443c7 into microsoft:master Jan 2, 2020
derrickstolee added a commit that referenced this pull request Jan 8, 2020
Replaces #258. Resolves #254.

If you have a "vanilla" Git repo, then run `scalar repos add` in that repo. Scalar will detect the repo root, register that root with the service, and the maintenance steps will run.

The way we identify a vanilla Git repo (now) is if the object cache dir is not given by config and hence we do all operations on the local `.git` folder. This will not work with Git worktrees, but we will also not discover a `.git` _folder_ (worktrees use a `.git` _file_) so the enlistment will be invalid.

* The `commit-graph` task will generate the incremental commit-graph files using the `--reachable` option. This will be a no-op if the user has not changed their refs.

* The `packfile` task will write a `multi-pack-index` and do the expire/repack logic. To actually do something, the batch-size is decreased if the total pack size is smaller than 2gb. (This was done in #272.)

* The `loose-objects` task will delete loose objects already in pack-files and put them into a new `from-loose` pack. This required no change.

* The `fetch-commits-and-trees` task is renamed the `fetch` task. On a vanilla Git repo, it will simply call `git fetch <remote> --no-update-remote-refs +refs/head/*:refs/hidden/<remote>/*` for each `<remote>` given by `git remote`. This downloads a pack-file with the new objects not reachable form the current refs, but also does not update `refs/remotes/`. The user will see their refs update as normal, but the pack download is much smaller.

* The `config` task (added by #272) runs the necessary Git config.  This step is run in `scalar repos add`, but also in the background with the service. All config options become optional for vanilla Git repos, so a user can opt-out of the settings we recommend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a config maintenance step

2 participants