From eb2a29ba9ada1a408c48c3991267e4c2ca27bc46 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Wed, 2 Apr 2008 18:44:39 -0400 Subject: [PATCH] regression: test the new init options Signed-off-by: Josef 'Jeff' Sipek --- regression/scaffold | 20 +++++++++++++++++--- regression/t-010.out | 35 +++++++++++++++++++++++++++++++++++ regression/t-010.sh | 27 ++++++++++++++------------- 3 files changed, 66 insertions(+), 16 deletions(-) diff --git a/regression/scaffold b/regression/scaffold index 49844a9..6a1cef8 100644 --- a/regression/scaffold +++ b/regression/scaffold @@ -64,12 +64,11 @@ function setup_git_repo echo "abc" > def git-add def git-commit -s -m "initial" 2> /dev/null > /dev/null + # the commit should be d4850419ccc1146c7169f500725ce504b9774ed0 } -function setup_repo +function setup_guilt_repo { - setup_git_repo - mkdir -p .git/patches/master # patch to modify a file @@ -99,3 +98,18 @@ function setup_repo touch -a -m -t "$TOUCH_DATE" .git/patches/master/mode } +function reset_git_repo +{ + git-checkout master + + git-reset --hard d4850419ccc1146c7169f500725ce504b9774ed0 + + rm -rf .git/patches/ +} + +function setup_repo +{ + setup_git_repo + setup_guilt_repo +} + diff --git a/regression/t-010.out b/regression/t-010.out index f17eff7..32fcd7c 100644 --- a/regression/t-010.out +++ b/regression/t-010.out @@ -1,4 +1,7 @@ % setup_git_repo +% reset_git_repo +Already on branch "master" +HEAD is now at d485041... initial % guilt-init % list_files d .git/patches @@ -12,6 +15,38 @@ d .git/patches d .git/patches/master f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/series f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status +% reset_git_repo +Already on branch "master" +HEAD is now at d485041... initial +% guilt-init -a +% list_files +d .git/patches +d .git/patches/master +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/series +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status +% guilt-init -a +Branch master appears to be already initialized (GIT_DIR=PATH/.git) +% list_files +d .git/patches +d .git/patches/master +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/series +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status +% reset_git_repo +Already on branch "master" +HEAD is now at d485041... initial +% guilt-init -n +% list_files +d .git/patches +d .git/patches/master +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/series +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status +% guilt-init -n +Branch master appears to be already initialized (GIT_DIR=PATH/.git) +% list_files +d .git/patches +d .git/patches/master +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/series +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status % git-branch other % git-checkout other Switched to branch "other" diff --git a/regression/t-010.sh b/regression/t-010.sh index 7c2818c..c9a5825 100755 --- a/regression/t-010.sh +++ b/regression/t-010.sh @@ -5,29 +5,30 @@ source $REG_DIR/scaffold -function relative_git_dir_path +function opts { - sed -e "s,GIT_DIR=$PWD/,GIT_DIR=," + cat << DONE + +-a +-n +DONE } cmd setup_git_repo -cmd guilt-init - -cmd list_files - -shouldfail guilt-init | relative_git_dir_path +opts | while read opt ; do + cmd reset_git_repo -cmd list_files + cmd guilt-init $opt + cmd list_files + shouldfail guilt-init $opt + cmd list_files +done cmd git-branch other - cmd git-checkout other cmd guilt-init - cmd list_files - -shouldfail guilt-init | relative_git_dir_path - +shouldfail guilt-init cmd list_files -- 2.11.4.GIT