Staging
v0.5.1
https://github.com/git/git
Raw File
Tip revision: 34d5217584ee4722d0c0b07ed6c8f1f01ad157c3 authored by Junio C Hamano on 28 May 2014, 22:50:22 UTC
Git 1.9.4
Tip revision: 34d5217
t1420-lost-found.sh
#!/bin/sh
#
# Copyright (c) 2007 Johannes E. Schindelin
#

test_description='Test fsck --lost-found'
. ./test-lib.sh

test_expect_success setup '
	git config core.logAllRefUpdates 0 &&
	: > file1 &&
	git add file1 &&
	test_tick &&
	git commit -m initial &&
	echo 1 > file1 &&
	echo 2 > file2 &&
	git add file1 file2 &&
	test_tick &&
	git commit -m second &&
	echo 3 > file3 &&
	git add file3
'

test_expect_success 'lost and found something' '
	git rev-parse HEAD > lost-commit &&
	git rev-parse :file3 > lost-other &&
	test_tick &&
	git reset --hard HEAD^ &&
	git fsck --lost-found &&
	test 2 = $(ls .git/lost-found/*/* | wc -l) &&
	test -f .git/lost-found/commit/$(cat lost-commit) &&
	test -f .git/lost-found/other/$(cat lost-other)
'

test_done
back to top