1 |
On Sat, Jul 14, 2018 at 8:00 AM Peter Humphrey <peter@××××××××××××.uk> wrote: |
2 |
> |
3 |
> That's all I need for the portage tree, unless removing everything at lower |
4 |
> depths will remove the change records. |
5 |
|
6 |
If you clone with a depth of one you'll see the current state of the |
7 |
tree, and a commit message from the CI bot, and that is it. You'll |
8 |
have zero change history for anything. |
9 |
|
10 |
If you clone with a dept of 10 you'll see one or two CI bot messages, |
11 |
and then the last 8 or so actual changes to the tree. You'll also |
12 |
have access to what the tree looked like when each of those changes |
13 |
was made. |
14 |
|
15 |
Note that git uses COW and compression, so the cost of increasing your |
16 |
depth isn't very high. A depth of 1 costs you about 670M, and a depth |
17 |
of 236000 costs you 1.5G. I'd expect the cost to be roughly linear |
18 |
between these. |
19 |
|
20 |
> |
21 |
> Is there something in git to do that purging? If not, perhaps a simple monthly |
22 |
> script to delete /usr/portage/* - but not packages or distfiles, which are on |
23 |
> separate partitions here - would do the trick. |
24 |
|
25 |
That delete would certainly work, though it would cost you a full sync |
26 |
(which would go back to your depth setting). I'd suggest moving |
27 |
distfiles outside of the repo if you're going to do that (really, it |
28 |
shouldn't be inside anyway), just to make it easier. |
29 |
|
30 |
git has no facilities to do this automatically, probably because it |
31 |
isn't something Linus does and git is very much his thing. However, I |
32 |
found that this works for me: |
33 |
|
34 |
git rev-parse HEAD >! .git/shallow |
35 |
git reflog expire --expire=all --all |
36 |
git gc --prune=now |
37 |
|
38 |
(This is a combination of: |
39 |
https://stackoverflow.com/a/34829535 (which doesn't work) |
40 |
and |
41 |
https://stackoverflow.com/a/46004595 (which is incomplete)) |
42 |
|
43 |
It runs in about 14s for me in a tmpfs. |
44 |
|
45 |
Another option would be to a local shallow clone and swap the repositories. |
46 |
|
47 |
You'll find tons of guides online for throwing out history that |
48 |
involve rebasing. You do NOT want to do this here. These will change |
49 |
the hash of the HEAD, which means that the next git pull won't be a |
50 |
fast-forward, and it will be a mess in general. You just want to |
51 |
discard local history, not rewrite the repository to say that there |
52 |
never was any history. |
53 |
|
54 |
Also note that the first line in this little script depends somewhat |
55 |
on git internals and may or may not work in the distant future. |
56 |
|
57 |
In any case, I suggest trying it. If it somehow eats your repo for |
58 |
breakfast just delete it and the next sync will re-fetch. |
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
-- |
65 |
Rich |