aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-25 14:13:44 -0700
committerJunio C Hamano <gitster@pobox.com>2016-07-25 14:13:44 -0700
commit9db397978416f9d562a94e55db86c7a45210a05c (patch)
tree7229b749a1f9eefe19a522fe5a5b4d0f18bea8b2 /t
parent3cc75c10d781572a073d7dbff4e1695b93a89d48 (diff)
parent90cf590f53f2939a47ca7b397e270e8228699829 (diff)
downloadgit-9db397978416f9d562a94e55db86c7a45210a05c.tar.gz
git-9db397978416f9d562a94e55db86c7a45210a05c.tar.xz
Merge branch 'js/fsck-name-object'
When "git fsck" reports a broken link (e.g. a tree object contains a blob that does not exist), both containing object and the object that is referred to were reported with their 40-hex object names. The command learned the "--name-objects" option to show the path to the containing object from existing refs (e.g. "HEAD~24^2:file.txt"). * js/fsck-name-object: fsck: optionally show more helpful info for broken links fsck: give the error function a chance to see the fsck_options fsck_walk(): optionally name objects on the go fsck: refactor how to describe objects
Diffstat (limited to 't')
-rwxr-xr-xt/t1450-fsck.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 7ee8ea004..8f52da277 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -523,4 +523,26 @@ test_expect_success 'fsck --connectivity-only' '
)
'
+remove_loose_object () {
+ sha1="$(git rev-parse "$1")" &&
+ remainder=${sha1#??} &&
+ firsttwo=${sha1%$remainder} &&
+ rm .git/objects/$firsttwo/$remainder
+}
+
+test_expect_success 'fsck --name-objects' '
+ rm -rf name-objects &&
+ git init name-objects &&
+ (
+ cd name-objects &&
+ test_commit julius caesar.t &&
+ test_commit augustus &&
+ test_commit caesar &&
+ remove_loose_object $(git rev-parse julius:caesar.t) &&
+ test_must_fail git fsck --name-objects >out &&
+ tree=$(git rev-parse --verify julius:) &&
+ grep "$tree (\(refs/heads/master\|HEAD\)@{[0-9]*}:" out
+ )
+'
+
test_done