#!/bin/sh global test_description := ''basic git gc tests '' source ./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 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"basic git gc tests\n">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <"gc empty repository">)} {(SQ <"\n"> <"\tgit gc\n">)}) (C {(test_expect_success)} {(SQ <"gc does not leave behind pid file">)} {(SQ <"\n"> <"\tgit gc &&\n"> <"\ttest_path_is_missing .git/gc.pid\n">)} ) (C {(test_expect_success)} {(SQ <"gc --gobbledegook">)} { (SQ <"\n"> <"\ttest_expect_code 129 git gc --nonsense 2>err &&\n"> <"\ttest_i18ngrep \"[Uu]sage: git gc\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"gc -h with invalid configuration">)} { (SQ <"\n"> <"\tmkdir broken &&\n"> <"\t(\n"> <"\t\tcd broken &&\n"> <"\t\tgit init &&\n"> <"\t\techo \"[gc] pruneexpire = CORRUPT\" >>.git/config &&\n"> <"\t\ttest_expect_code 129 git gc -h >usage 2>&1\n"> <"\t) &&\n"> <"\ttest_i18ngrep \"[Uu]sage\" broken/usage\n"> ) } ) (C {(test_expect_success)} {(SQ <"gc is not aborted due to a stale symref">)} { (SQ <"\n"> <"\tgit init remote &&\n"> <"\t(\n"> <"\t\tcd remote &&\n"> <"\t\ttest_commit initial &&\n"> <"\t\tgit clone . ../client &&\n"> <"\t\tgit branch -m develop &&\n"> <"\t\tcd ../client &&\n"> <"\t\tgit fetch --prune &&\n"> <"\t\tgit gc\n"> <"\t)\n"> ) } ) (C {(test_done)}) ] )