interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t1420-lost-found.sh

39 lines · 771 bytes Raw Blame History
1#!/bin/sh
2#
3# Copyright (c) 2007 Johannes E. Schindelin
4#
5
6test_description='Test fsck --lost-found'
7
8. ./test-lib.sh
9
10test_expect_success setup '
11 git config core.logAllRefUpdates 0 &&
12 : > file1 &&
13 git add file1 &&
14 test_tick &&
15 git commit -m initial &&
16 echo 1 > file1 &&
17 echo 2 > file2 &&
18 git add file1 file2 &&
19 test_tick &&
20 git commit -m second &&
21 echo 3 > file3 &&
22 git add file3
23'
24
25test_expect_success 'lost and found something' '
26 git rev-parse HEAD > lost-commit &&
27 git rev-parse :file3 > lost-other &&
28 test_tick &&
29 git reset --hard HEAD^ &&
30 git fsck --lost-found &&
31 ls .git/lost-found/*/* >actual &&
32 cat >expect <<-EOF &&
33 .git/lost-found/commit/$(cat lost-commit)
34 .git/lost-found/other/$(cat lost-other)
35 EOF
36 test_cmp expect actual
37'
38
39test_done