Skip to content

Commit e6c74df

Browse files
authored
Use git clean to remove untracked files; shallow clone for faster clones (#91)
* Use git clean to remove untracked files; shallow clone for faster clones - When the registration server crashes abruptly it can sometimes leave behind untracked files from a previous registration. This can cause issues like JuliaRegistries/General#81954. Here I added a `git clean -fd` before checkout so that untracked files will be cleaned. - Added `-q --depth=1` to `git clone`s so that cloning will be faster and quieter in the logs. * Update Project.toml
1 parent ac9e9cf commit e6c74df

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RegistryTools"
22
uuid = "d1eb7eb1-105f-429d-abf5-b0f65cb9e2c4"
33
authors = ["Stefan Karpinski <stefan@karpinski.org>"]
4-
version = "2.2.1"
4+
version = "2.2.2"
55

66
[deps]
77
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"

src/types.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ function get_registry(
6969

7070
if !ispath(registry_path)
7171
mkpath(path(cache))
72-
run(`git clone $registry_url $registry_path`)
72+
run(`git clone -q --depth=1 $registry_url $registry_path`)
7373
else
7474
# this is really annoying/impossible to do with LibGit2
7575
git = gitcmd(registry_path, gitconfig)
7676
run(`$git config remote.origin.url $registry_url`)
7777
registry_defbranch = get_registry_default_branch(git)
78+
run(`$git clean -fd`)
7879
run(`$git checkout -q -f $registry_defbranch`)
7980
# uses config because git versions <2.17.0 did not have the -P option
8081
run(`$git -c fetch.pruneTags fetch -q origin $registry_defbranch`)
@@ -85,7 +86,7 @@ function get_registry(
8586
else
8687
registry_temp = mktempdir(mkpath(path(cache)))
8788
try
88-
run(`git clone $registry_url $registry_temp`)
89+
run(`git clone -q --depth=1 $registry_url $registry_temp`)
8990
reg = parse_registry(joinpath(registry_temp, "Registry.toml"))
9091
registry_uuid = cache.registries[registry_url] = reg.uuid
9192
registry_path = path(cache, registry_uuid)

0 commit comments

Comments
 (0)