@matheusbsbs / matheus-bagliano / commits / 14c8a681f7
Fork 0

Clean up "git-branch.sh" and add remove recursive dir test cases.

Now that directory recursive remove works in the core C code, we don't need to do it in "git-branch.sh". Also add test cases to check that directory recursive remove will continue to work. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Christian Couder committed Oct 1, 2006 at 14:38 UTC 14c8a681f751c425f47be38a5e98b514f000d499
2 files changed +27 -10
git-branch.sh
-10
@@ -111,16 +111,6 @@ rev=$(git-rev-parse --verify "$head") || exit
111 git-check-ref-format "heads/$branchname" ||
112 die "we do not like '$branchname' as a branch name."
113
114 -if [ -d "$GIT_DIR/refs/heads/$branchname" ]
115 -then
116 - for refdir in `cd "$GIT_DIR" && \
117 - find "refs/heads/$branchname" -type d | sort -r`
118 - do
119 - rmdir "$GIT_DIR/$refdir" || \
120 - die "Could not delete '$refdir', there may still be a ref there."
121 - done
122 -fi
123 -
114 prev=''
115 if git-show-ref --verify --quiet -- "refs/heads/$branchname"
116 then
t/t3210-pack-refs.sh
+27
@@ -67,4 +67,31 @@ test_expect_success \
67 git-pack-refs &&
68 git-branch -d g'
69
70 +test_expect_failure \
71 + 'git branch i/j/k should barf if branch i exists' \
72 + 'git-branch i &&
73 + git-pack-refs --prune &&
74 + git-branch i/j/k'
75 +
76 +test_expect_success \
77 + 'test git branch k after branch k/l/m and k/lm have been deleted' \
78 + 'git-branch k/l &&
79 + git-branch k/lm &&
80 + git-branch -d k/l &&
81 + git-branch k/l/m &&
82 + git-branch -d k/l/m &&
83 + git-branch -d k/lm &&
84 + git-branch k'
85 +
86 +test_expect_success \
87 + 'test git branch n after some branch deletion and pruning' \
88 + 'git-branch n/o &&
89 + git-branch n/op &&
90 + git-branch -d n/o &&
91 + git-branch n/o/p &&
92 + git-branch -d n/op &&
93 + git-pack-refs --prune &&
94 + git-branch -d n/o/p &&
95 + git-branch n'
96 +
97 test_done