From 97f4d8c0ace3fd287d3ef8323587b2eb3e6b9106 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Thu, 11 Feb 2016 15:14:50 +0200 Subject: [PATCH 1/5] Add '.swp' as temp Vim extension in example Although Vim uses files that end with '~', usually 'git status' shows '.*.swp' file that is present during editing a file (~ file is present only at saving time) --- book/08-customizing-git/sections/config.asc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/book/08-customizing-git/sections/config.asc b/book/08-customizing-git/sections/config.asc index 9fc1794d7..80407cf7d 100644 --- a/book/08-customizing-git/sections/config.asc +++ b/book/08-customizing-git/sections/config.asc @@ -145,7 +145,7 @@ You can put patterns in your project's `.gitignore` file to have Git not see the But sometimes you want to ignore certain files for all repositories that you work with. If your computer is running Mac OS X, you're probably familiar with `.DS_Store` files. -If your preferred editor is Emacs or Vim, you know about files that end with a `~`. +If your preferred editor is Emacs or Vim, you know about files that end with a `~` or `.swp`. This setting lets you write a kind of global `.gitignore` file. If you create a `~/.gitignore_global` file with these contents: @@ -153,6 +153,7 @@ If you create a `~/.gitignore_global` file with these contents: [source,ini] ---- *~ +.*.swp .DS_Store ---- From 2309d873d6a15657e26f6fbe3a5b037c59759a46 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Thu, 11 Feb 2016 15:19:21 +0200 Subject: [PATCH 2/5] Fix 'sort' and 'uniq' order --- book/09-git-and-other-scms/sections/import-tfs.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/09-git-and-other-scms/sections/import-tfs.asc b/book/09-git-and-other-scms/sections/import-tfs.asc index a0064d04e..68a7f4cf9 100644 --- a/book/09-git-and-other-scms/sections/import-tfs.asc +++ b/book/09-git-and-other-scms/sections/import-tfs.asc @@ -25,12 +25,12 @@ Open the file and find at which characters start and end the column and replace, [source,powershell] ---- -PS> cat AUTHORS_TMP | cut -b 11-20 | tail -n+3 | uniq | sort > AUTHORS +PS> cat AUTHORS_TMP | cut -b 11-20 | tail -n+3 | sort | uniq > AUTHORS ---- The `cut` command keeps only the characters between 11 and 20 from each line. The `tail` command skips the first two lines, which are field headers and ASCII-art underlines. -The result of all of this is piped to `uniq` to eliminate duplicates, and saved to a file named `AUTHORS`. +The result of all of this is piped to `sort` and `uniq` to eliminate duplicates, and saved to a file named `AUTHORS`. The next step is manual; in order for git-tfs to make effective use of this file, each line must be in this format: [source,text] From ccb917b9392d3a5e7f2673a152cd82dd225f9216 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Thu, 11 Feb 2016 17:18:58 +0200 Subject: [PATCH 3/5] Add warning about different hashes I think it is better to warn reader that commit/tag hashes in 10th chapter are different from what he/she will get. Other hashes (of blobs and trees) are identical so reader can think that he has done something wrong --- book/10-git-internals/sections/objects.asc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/10-git-internals/sections/objects.asc b/book/10-git-internals/sections/objects.asc index 1c9a1858f..6a7ee2509 100644 --- a/book/10-git-internals/sections/objects.asc +++ b/book/10-git-internals/sections/objects.asc @@ -242,6 +242,8 @@ $ echo 'first commit' | git commit-tree d8329f fdf4fc3344e67ab068f836878b6c4951e3b15f3d ---- +You will get another hash value because of different creation time and author data. +Replace commit and tag hashes with your own checksums further in this chapter. Now you can look at your new commit object with `cat-file`: [source,console] From 5773f4c7dff8501166ce79ceca650e95816e46fa Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Thu, 11 Feb 2016 17:24:05 +0200 Subject: [PATCH 4/5] Fix sizes before gc and add change of branch * We need 'git checkout master' because we've left on 'test' branch in previous section * I was surprised that before gc we had only 22K objects, because we have two copies of 22K files. So I checked it and it appears that because of compression each of them takes only 7K place on disk. Also before compression all objects take 15K if summing them up (not 22K). --- book/10-git-internals/sections/packfiles.asc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/book/10-git-internals/sections/packfiles.asc b/book/10-git-internals/sections/packfiles.asc index 9bdc9827a..1d520ef63 100644 --- a/book/10-git-internals/sections/packfiles.asc +++ b/book/10-git-internals/sections/packfiles.asc @@ -26,6 +26,7 @@ To demonstrate, we'll add the `repo.rb` file from the Grit library – this is a [source,console] ---- $ curl https://raw.githubusercontent.com/mojombo/grit/master/lib/grit/repo.rb > repo.rb +$ git checkout master $ git add repo.rb $ git commit -m 'added repo.rb' [master 484a592] added repo.rb @@ -81,7 +82,7 @@ $ git cat-file -s b042a60ef7dff760008df33cee372b945b6e884e 22054 ---- -You have two nearly identical 22K objects on your disk. +You have two nearly identical 22K objects on your disk (each compressed to approximately 7K). 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? It turns out that it can. @@ -118,8 +119,8 @@ Because you never added them to any commits, they're considered dangling and are The other files are your new packfile and an index. The packfile is a single file containing the contents of all the objects that were removed from your filesystem. The index is a file that contains offsets into that packfile so you can quickly seek to a specific object. -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. -You've cut your disk usage by ⅔ by packing your objects. +What is cool is that although the objects on disk before you ran the `gc` were collectively about 15K in size, the new packfile is only 7K. +You've cut your disk usage by ½ by packing your objects. How does Git do this? 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. From 52c2d20ef799398d211bcd07679c5f0ecdcdb455 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Wed, 17 Feb 2016 20:44:16 +0200 Subject: [PATCH 5/5] Fix review issue: another -> a different --- book/10-git-internals/sections/objects.asc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/10-git-internals/sections/objects.asc b/book/10-git-internals/sections/objects.asc index 6a7ee2509..e372ebf56 100644 --- a/book/10-git-internals/sections/objects.asc +++ b/book/10-git-internals/sections/objects.asc @@ -242,7 +242,7 @@ $ echo 'first commit' | git commit-tree d8329f fdf4fc3344e67ab068f836878b6c4951e3b15f3d ---- -You will get another hash value because of different creation time and author data. +You will get a different hash value because of different creation time and author data. Replace commit and tag hashes with your own checksums further in this chapter. Now you can look at your new commit object with `cat-file`: