Skip to content

Commit 4ef0720

Browse files
committed
Translated section 10.4
1 parent c70c4bf commit 4ef0720

File tree

1 file changed

+44
-42
lines changed

1 file changed

+44
-42
lines changed

book/10-git-internals/sections/packfiles.asc

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
=== Packfiles
1+
=== Πακετάρισμα αρχείων
22

3-
Let's go back to the objects database for your test Git repository.
4-
At this point, you have 11 objects – 4 blobs, 3 trees, 3 commits, and 1 tag:
3+
Ας επιστρέψουμε στη βάση δεδομένων των αντικειμένων για το δοκιμαστικό μας αποθετήριο Git.
4+
Σε αυτό το σημείο, έχουμε 11 αντικείμενα --4 blobs, 3 δέντρα, 3 δεσμεύσεις και 1 ετικέτα:
55

66
[source,console]
77
----
88
$ find .git/objects -type f
9-
.git/objects/01/55eb4229851634a0f03eb265b69f5a2d56f341 # tree 2
10-
.git/objects/1a/410efbd13591db07496601ebc7a059dd55cfe9 # commit 3
9+
.git/objects/01/55eb4229851634a0f03eb265b69f5a2d56f341 # δέντρο 2
10+
.git/objects/1a/410efbd13591db07496601ebc7a059dd55cfe9 # υποβολή 3
1111
.git/objects/1f/7a7a472abf3dd9643fd615f6da379c4acb3e3a # test.txt v2
12-
.git/objects/3c/4e9cd789d88d8d89c1073707c3585e41b0e614 # tree 3
12+
.git/objects/3c/4e9cd789d88d8d89c1073707c3585e41b0e614 # δέντρο 3
1313
.git/objects/83/baae61804e65cc73a7201a7252750c76066a30 # test.txt v1
14-
.git/objects/95/85191f37f7b0fb9444f35a9bf50de191beadc2 # tag
15-
.git/objects/ca/c0cab538b970a37ea1e769cbbde608743bc96d # commit 2
14+
.git/objects/95/85191f37f7b0fb9444f35a9bf50de191beadc2 # ετικέτα
15+
.git/objects/ca/c0cab538b970a37ea1e769cbbde608743bc96d # υποβολή 2
1616
.git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4 # 'test content'
17-
.git/objects/d8/329fc1cc938780ffdd9f94e0d364e0ea74f579 # tree 1
17+
.git/objects/d8/329fc1cc938780ffdd9f94e0d364e0ea74f579 # δέντρο 1
1818
.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 # new.txt
19-
.git/objects/fd/f4fc3344e67ab068f836878b6c4951e3b15f3d # commit 1
19+
.git/objects/fd/f4fc3344e67ab068f836878b6c4951e3b15f3d # υποβολή 1
2020
----
2121

22-
Git compresses the contents of these files with zlib, and you're not storing much, so all these files collectively take up only 925 bytes.
23-
You'll add some larger content to the repository to demonstrate an interesting feature of Git.
24-
To demonstrate, we'll add the `repo.rb` file from the Grit library – this is about a 22K source code file:
22+
Το Git συμπιέζει τα περιεχόμενα αυτών των αρχείων με το zlib και δεν αποθηκεύουμε πολλά, έτσι ώστε όλα αυτά τα αρχεία έχουν αθροιστικά μόνο 925 byte.
23+
Θα προσθέσουμε μεγαλύτερο περιεχόμενο στο αποθετήριο για να δείξουμε ένα ενδιαφέρον χαρακτηριστικό του Git.
24+
Για να το καταδείξουμε, προσθέτουμε το αρχείο `repo.rb` από τη βιβλιοθήκη Grit --πρόκειται για ένα αρχείο πηγαίου κώδικα 22K:
2525

2626
[source,console]
2727
----
@@ -35,7 +35,7 @@ $ git commit -m 'added repo.rb'
3535
rewrite test.txt (100%)
3636
----
3737

38-
If you look at the resulting tree, you can see the SHA-1 value your repo.rb file got for the blob object:
38+
Αν κοιτάξουμε το δέντρο που προκύπτει, μπορούμε να δούμε την τιμή SHA-1 που έχει λάβει το αρχείο repo.rb για το αντικείμενο blob:
3939

4040
[source,console]
4141
----
@@ -45,15 +45,15 @@ $ git cat-file -p master^{tree}
4545
100644 blob e3f094f522629ae358806b17daf78246c27c007b test.txt
4646
----
4747

48-
You can then use `git cat-file` to see how big that object is:
48+
Μπορούμε να χρησιμοποιήσουμε την `git cat-file` για να δούμε πόσο μεγάλο είναι αυτό το αντικείμενο:
4949

5050
[source,console]
5151
----
5252
$ git cat-file -s 033b4468fa6b2a9547a70d88d1bbe8bf3f9ed0d5
5353
22044
5454
----
5555

56-
Now, modify that file a little, and see what happens:
56+
Τώρα, ας δούμε τι συμβαίνει αν τροποποιήσουμε λίγο το αρχείο:
5757

5858
[source,console]
5959
----
@@ -63,7 +63,7 @@ $ git commit -am 'modified repo a bit'
6363
1 file changed, 1 insertion(+)
6464
----
6565

66-
Check the tree created by that commit, and you see something interesting:
66+
Αν ελέγξουμε το δέντρο που δημιουργήθηκε από αυτήν την υποβολή, βλέπουμε κάτι ενδιαφέρον:
6767

6868
[source,console]
6969
----
@@ -73,22 +73,22 @@ $ git cat-file -p master^{tree}
7373
100644 blob e3f094f522629ae358806b17daf78246c27c007b test.txt
7474
----
7575

76-
The blob is now a different blob, which means that although you added only a single line to the end of a 400-line file, Git stored that new content as a completely new object:
76+
Το blob είναι τώρα ένα διαφορετικό blob, πράγμα που σημαίνει ότι αν και προσθέσατε μόνο μία γραμμή στο τέλος ενός αρχείου 400 γραμμών, το Git αποθηκεύει αυτό το νέο περιεχόμενο ως ένα εντελώς νέο αντικείμενο:
7777

7878
[source,console]
7979
----
8080
$ git cat-file -s b042a60ef7dff760008df33cee372b945b6e884e
8181
22054
8282
----
8383

84-
You have two nearly identical 22K objects on your disk.
85-
Wouldn't it be nice if Git could store one of them in full but then the second object only as the delta between it and the first?
84+
Έχουμε δύο σχεδόν ταυτόσημα αντικείμενα 22K στο δίσκο μας.
85+
Δεν θα ήταν ωραίο αν το Git μπορούσε να αποθηκεύσει ένα από αυτά πλήρως, αλλά το δεύτερο αντικείμενο μόνο ως το δέλτα μεταξύ αυτού και του πρώτου;
8686

87-
It turns out that it can.
88-
The initial format in which Git saves objects on disk is called a ``loose'' object format.
89-
However, occasionally Git packs up several of these objects into a single binary file called a ``packfile'' in order to save space and be more efficient.
90-
Git does this if you have too many loose objects around, if you run the `git gc` command manually, or if you push to a remote server.
91-
To see what happens, you can manually ask Git to pack up the objects by calling the `git gc` command:
87+
Ε, λοιπόν, μπορεί.
88+
Η αρχική μορφή στην οποία το Git αποθηκεύει αντικείμενα στον δίσκο ονομάζεται _χαλαρή_ μορφή αντικειμένου.
89+
Εντούτοις, περιστασιακά το Git ``πακετάρει'' αρκετά από αυτά τα αντικείμενα σε ένα μόνο δυαδικό αρχείο που ονομάζεται πακέτο (packfile) για να εξοικονομήσει χώρο και να είναι πιο αποδοτικό.
90+
Το Git το κάνει αυτό εάν έχουμε πολλά χαλαρά αντικείμενα γύρω μας, αν εκτελέσουμε χειροκίνητα την εντολή `git gc` ή αν ωθήσουμε σε έναν απομακρυσμένο διακομιστή.
91+
Για να δούμε τι συμβαίνει, μπορούμε να ζητήσουμε από το Git να συσκευάσει τα αντικείμενα καλώντας την εντολή `git gc`:
9292

9393
[source,console]
9494
----
@@ -100,7 +100,7 @@ Writing objects: 100% (18/18), done.
100100
Total 18 (delta 3), reused 0 (delta 0)
101101
----
102102

103-
If you look in your objects directory, you'll find that most of your objects are gone, and a new pair of files has appeared:
103+
Αν κοιτάξουμε στον κατάλογο των αντικειμένων μας, θα διαπιστώσουμε ότι τα περισσότερα αντικείμενά μας έχουν εξαφανιστεί και εμφανίστηκε ένα νέο ζευγάρι αρχείων:
104104

105105
[source,console]
106106
----
@@ -112,19 +112,20 @@ $ find .git/objects -type f
112112
.git/objects/pack/pack-978e03944f5c581011e6998cd0e9e30000905586.pack
113113
----
114114

115-
The objects that remain are the blobs that aren't pointed to by any commit – in this case, the ``what is up, doc?'' example and the ``test content'' example blobs you created earlier.
116-
Because you never added them to any commits, they're considered dangling and aren't packed up in your new packfile.
115+
Τα αντικείμενα που παραμένουν είναι τα blob στα οποία δεν δείχνει καμία υποβολή --στην περίπτωση αυτή, τα ``what up, doc'' και ``test content'' που δημιουργήσαμε νωρίτερα.
116+
Επειδή δεν τα προσθέσαμε ποτέ σε καμία υποβολή, θεωρούνται ότι εκκρεμή και δεν έχουν συσκευαστεί στο νέο μας πακέτο.
117117

118-
The other files are your new packfile and an index.
119-
The packfile is a single file containing the contents of all the objects that were removed from your filesystem.
120-
The index is a file that contains offsets into that packfile so you can quickly seek to a specific object.
121-
What is cool is that although the objects on disk before you ran the `gc` were collectively about 22K in size, the new packfile is only 7K.
122-
You've cut your disk usage by ⅔ by packing your objects.
118+
Τα άλλα αρχεία είναι το νέο πακέτο και ένα ευρετήριο.
119+
Το πακέτο είναι μόνον ένα αρχείο που περιέχει τα περιεχόμενα όλων των αντικειμένων που έχουν αφαιρεθεί από το σύστημα αρχείων μας.
120+
Το ευρετήριο είναι ένα αρχείο που περιέχει τις θέσεις σε byte των αντικειμένων σε αυτό το packfile ώστε η αναζήτηση ενός συγκεκριμένου αντικειμένου να γίνεται γρήγορα.
123121

124-
How does Git do this?
125-
When Git packs objects, it looks for files that are named and sized similarly, and stores just the deltas from one version of the file to the next.
126-
You can look into the packfile and see what Git did to save space.
127-
The `git verify-pack` plumbing command allows you to see what was packed up:
122+
Το ωραίο είναι ότι αν και τα αντικείμενα στον δίσκο προτού εκτελέσουμε την `gc` ήταν συνολικά περίπου 22Κ σε μέγεθος, το νέο πάκο είναι μόνο 7K.
123+
Έχουμε μειώσει τη χρήση του δίσκου κατά ⅔ επειδή πακετάραμε τα αντικείμενά μας.
124+
125+
Πώς το κάνει αυτό το Git;
126+
Όταν το Git πακετάρει αντικείμενα, ψάχνει για αρχεία που έχουν παρόμοιο όνομα και μέγεθος και αποθηκεύει μόνο τις διαφορές (deltas) από μια έκδοση του αρχείου στην επόμενη.
127+
Μπορούμε να δούμε μέσα στο πακέτο και να δούμε τι έκανε το Git για να εξοικονομήσει χώρο.
128+
Η εντολή `git verify-pack` μας δίνει τη δυνατότητα να δούμε τι ήταν συσκευάστηκε στο πακέτο:
128129

129130
[source,console]
130131
----
@@ -155,9 +156,10 @@ chain length = 1: 3 objects
155156
.git/objects/pack/pack-978e03944f5c581011e6998cd0e9e30000905586.pack: ok
156157
----
157158

158-
Here, the `033b4` blob, which if you remember was the first version of your repo.rb file, is referencing the `b042a` blob, which was the second version of the file.
159-
The third column in the output is the size of the object in the pack, so you can see that `b042a` takes up 22K of the file, but that `033b4` only takes up 9 bytes.
160-
What is also interesting is that the second version of the file is the one that is stored intact, whereas the original version is stored as a delta – this is because you're most likely to need faster access to the most recent version of the file.
159+
Εδώ, το blob `033b4`, το οποίο, ας θυμηθούμε, ήταν η πρώτη έκδοση του αρχείου repo.rb γίνεται αναφορά στο blob `b042a`, που ήταν η δεύτερη έκδοση του αρχείου.
160+
Η τρίτη στήλη στην έξοδο είναι το μέγεθος του αντικειμένου στο πακέτο, ώστε να μπορούμε να δούμε ότι το `b042a` καταλαμβάνει 22Κ του αρχείου, αλλά το `033b4` καταλαμβάνει μόνο 9 byte.
161+
Αυτό που είναι επίσης ενδιαφέρον είναι ότι η δεύτερη έκδοση του αρχείου είναι αυτή που είναι αποθηκευμένη άθικτη, ενώ η αρχική έκδοση αποθηκεύεται ως δέλτα --αυτό γίνεται επειδή πιθανότατα θα χρειαστούμε ταχύτερη πρόσβαση στην πιο πρόσφατη έκδοση του αρχείου .
162+
163+
Αυτό που είναι πραγματικά ωραίο είναι ότι μπορεί να ανασυσκευαστεί ανά πάσα στιγμή.
164+
Το Git ξαναπακετάρει κατά καιρούς τη βάση δεδομένων μας αυτόματα, προσπαθώντας πάντα να εξοικονομήσει περισσότερο χώρο, αλλά μπορούμε επίσης να επανασυσκευάσουμε μη-αυτόματα οποιαδήποτε στιγμή τρέχοντας `git gc`.
161165

162-
The really nice thing about this is that it can be repacked at any time.
163-
Git will occasionally repack your database automatically, always trying to save more space, but you can also manually repack at any time by running `git gc` by hand.

0 commit comments

Comments
 (0)