uais comandos git executam verificações de integridad
entando determinar a rapidez com que um usuário seria avisado de corrupção no banco de dados de objetos com o git-1.7.4.1, puxei um switcheroo de um bit:
$ git init repo Initialized empty Git repository in /tmp/repo/.git/ $ cd repo $ echo 'very important info' >critical $ git add critical $ git commit -m critical [master (root-commit) c4d6d90] critical 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 critical $ git ls-tree HEAD 100644 blob 82d423c32c4bb2c52938088e0234db041bf4eaaf critical $ git show 82d423c32c4bb2c52938088e0234db041bf4eaaf very important info $ echo 'Very important info' | git hash-object --stdin -w 81a3797afe76d339db25c0f9c705a6caa47279c2 $ mv .git/objects/81/a3797afe76d339db25c0f9c705a6caa47279c2 \ .git/objects/82/d423c32c4bb2c52938088e0234db041bf4eaaf
Claro,git-fsck
avisos
$ git fsck error: sha1 mismatch 82d423c32c4bb2c52938088e0234db041bf4eaaf error: 82d423c32c4bb2c52938088e0234db041bf4eaaf: object corrupt or missing missing blob 82d423c32c4bb2c52938088e0234db041bf4eaaf
masgit-log
está feliz com a mudança
$ git log -p commit c4d6d90467af9ffa94772795d5c5d191228933c1 Author: Greg Bacon <[email protected]> Date: Thu Apr 7 12:20:53 2011 -0500 critical diff --git a/critical b/critical new file mode 100644 index 0000000..82d423c --- /dev/null +++ b/critical @@ -0,0 +1 @@ +Very important info
como égit-checkout
.
$ rm critical $ git checkout . $ cat critical Very important info
Uma chamada específica degit-show
revela a corrupção
$ git show 82d423c32c4bb2c52938088e0234db041bf4eaaf error: sha1 mismatch 82d423c32c4bb2c52938088e0234db041bf4eaaf fatal: bad object 82d423c32c4bb2c52938088e0234db041bf4eaaf
mas não mais amplo.
$ git show commit c4d6d90467af9ffa94772795d5c5d191228933c1 Author: Greg Bacon <[email protected]> Date: Thu Apr 7 12:20:53 2011 -0500 critical diff --git a/critical b/critical new file mode 100644 index 0000000..82d423c --- /dev/null +++ b/critical @@ -0,0 +1 @@ +Very important info
Atégit-clone
não percebe!
$ cd .. $ git clone repo clone Cloning into clone... done. $ cat clone/critical Very important info
Qual é a lista completa dos modos de comando git específicos por exemplo, git show $sha1
deve estar presente, mas nãogit show
ougit show HEAD
) que executam verificações de integridade?