mirror of
https://github.com/git/git.git
synced 2024-11-01 06:47:52 +01:00
14886b40c5
It is quite possible for, say, a remote HEAD to become broken, e.g. when the default branch was renamed. We should still be able to pack our objects when such a thing happens; simply ignore broken symrefs (because they cannot matter for the packing process anyway). This fixes https://github.com/git-for-windows/git/issues/423 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
46 lines
860 B
Bash
Executable file
46 lines
860 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='basic git gc tests
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'gc empty repository' '
|
|
git gc
|
|
'
|
|
|
|
test_expect_success 'gc does not leave behind pid file' '
|
|
git gc &&
|
|
test_path_is_missing .git/gc.pid
|
|
'
|
|
|
|
test_expect_success 'gc --gobbledegook' '
|
|
test_expect_code 129 git gc --nonsense 2>err &&
|
|
test_i18ngrep "[Uu]sage: git gc" err
|
|
'
|
|
|
|
test_expect_success 'gc -h with invalid configuration' '
|
|
mkdir broken &&
|
|
(
|
|
cd broken &&
|
|
git init &&
|
|
echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
|
|
test_expect_code 129 git gc -h >usage 2>&1
|
|
) &&
|
|
test_i18ngrep "[Uu]sage" broken/usage
|
|
'
|
|
|
|
test_expect_success 'gc is not aborted due to a stale symref' '
|
|
git init remote &&
|
|
(
|
|
cd remote &&
|
|
test_commit initial &&
|
|
git clone . ../client &&
|
|
git branch -m develop &&
|
|
cd ../client &&
|
|
git fetch --prune &&
|
|
git gc
|
|
)
|
|
'
|
|
|
|
test_done
|