-
Notifications
You must be signed in to change notification settings - Fork 210
Run git gc periodically on the crates.io index (#778) #956
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
Changes from 19 commits
69e51b4
9cb547f
3d0ec4e
ce5bbcf
94f8ac3
6335dd5
d3e2c80
8d06f51
e323a2f
6d66f9e
29b1113
014338c
45892ff
525c6f8
1e4d83e
39e5b26
3be80f5
1ba6fd5
7f09aea
f91a2fe
68332f7
b5ec00c
b1d4a38
e6f1734
7e74a68
1fa9a7f
98a0a1b
f840c5f
14f8730
87d6fe4
5c45d4b
7fe6225
f914f1b
b5ab712
12c8828
200e340
35584bb
2d23d4c
d250251
154cb1e
793bd58
9436391
c9b7fe1
f23e41c
13e68ca
083f5d3
9da332f
39f7db6
13827d6
ba416f6
e54a21f
7266be3
f25e599
4751bf2
11930e0
80d2cbc
de82def
3440e52
a94cb90
fcf3302
819d32b
eb47785
8a4eec3
ffc3d9e
c8744fe
a9f04c4
e8daa76
b622d56
860c276
ad575fa
9897721
95b6061
b53b87d
618d966
4e7b8a6
0a0128f
4867b38
16fb2a7
58ab2b2
d6383e7
19ca702
a1ef4bc
6715bed
b073e27
f231072
ad35125
4f9fd37
755eda1
4b48570
50473e7
c651b13
20bed43
0ab6ece
655dd18
26bd4e3
d585733
a17c0c5
0478cdf
7688b67
252edf9
69b363e
37bc3aa
5285793
993aef8
b992cc2
18e89b5
7a5b5d7
2868dea
6087b61
c69d553
29412b9
c063e0c
7374345
def42a4
fe68adb
29ecb45
d2c20c4
3214302
d072f02
cb406be
a6a5c65
28065e1
be9e3e0
89578dd
87ed97d
2bf3ae3
a9efd05
d7c0ec1
a7568a2
db8ce50
4121fb6
c7fcff6
d8b8a75
60c58fb
3ec3b83
79a295d
02bc0ff
ff02d23
5722ae1
6c7193b
ef9cd22
a593212
5b0cc9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env sh | ||
if ! cargo fmt -- --check ; then | ||
printf "\n" | ||
printf "\033[0;31mpre-commit hook failed during:\033[0m\n" | ||
printf "\033[0;31m\tcargo fmt -- --check\033[0m\n" | ||
exit 1 | ||
fi | ||
|
||
if ! cargo clippy --locked -- -D warnings ; then | ||
printf "\n" | ||
printf "\033[0;31mpre-commit hook failed during:\033[0m\n" | ||
printf "\033[0;31m\tclippy --locked -- -D warning\033[0m\n" | ||
exit 1 | ||
fi | ||
|
||
printf "\n" | ||
printf "\033[0;32mpre-commit hook succeeded\033[0m\n" | ||
exit 0 | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -22,6 +22,12 @@ The recommended way to develop docs.rs is a combination of `cargo run` for | |||||||||||||||||||
the main binary and [docker-compose](https://docs.docker.com/compose/) for the external services. | ||||||||||||||||||||
This gives you reasonable incremental build times without having to add new users and packages to your host machine. | ||||||||||||||||||||
|
||||||||||||||||||||
### Git Hooks | ||||||||||||||||||||
For ease of use, `git_hooks` directory contains useful `git hooks` to make your development easier. | ||||||||||||||||||||
```bash | ||||||||||||||||||||
cd .git/hooks && ln -s ../../.git_hooks/* . && cd ../.. | ||||||||||||||||||||
``` | ||||||||||||||||||||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
### Dependencies | ||||||||||||||||||||
|
||||||||||||||||||||
Docs.rs requires at least the following native C dependencies. | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,5 @@ | ||||||||||||
use std::path::{Path, PathBuf}; | ||||||||||||
use std::process::Command; | ||||||||||||
Comment on lines
1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
||||||||||||
use url::Url; | ||||||||||||
|
||||||||||||
|
@@ -50,6 +51,14 @@ impl Index { | |||||||||||
Ok(Self { path, api }) | ||||||||||||
} | ||||||||||||
|
||||||||||||
pub fn run_git_gc(&self) { | ||||||||||||
let cmd = format!("cd {} && gc --auto", self.path.to_str().unwrap()); | ||||||||||||
let gc = Command::new("sh").args(&["-c", cmd.as_str()]).output(); | ||||||||||||
Kixiron marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Avoids the use of |
||||||||||||
if let Err(err) = gc { | ||||||||||||
Comment on lines
+56
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
log::error!("Failed to run `{}`: {:?}", cmd, err); | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
pub(crate) fn diff(&self) -> Result<crates_index_diff::Index> { | ||||||||||||
let diff = crates_index_diff::Index::from_path_or_cloned(&self.path) | ||||||||||||
.context("re-opening registry index for diff")?; | ||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.