Skip to content

Commit 638624d

Browse files
committed
t5505,t5516: create .git/branches/ when needed
It is a real old anachronism from the Cogito days to have a .git/branches/ directory. And to have tests that ensure that Cogito users can migrate away from using that directory. But so be it, let's continue testing it. Let's make sure, however, that git init does not need to create that directory. This bug was noticed when testing with templates that had been pre-committed, skipping the empty branches/ directory of course because Git does not track empty directories. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent c3c7903 commit 638624d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

t/t5505-remote.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
830830
(
831831
cd six &&
832832
git remote rm origin &&
833+
mkdir -p .git/branches &&
833834
echo "$origin_url" >.git/branches/origin &&
834835
git remote rename origin origin &&
835836
test_path_is_missing .git/branches/origin &&
@@ -844,6 +845,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
844845
(
845846
cd seven &&
846847
git remote rm origin &&
848+
mkdir -p .git/branches &&
847849
echo "quux#foom" > .git/branches/origin &&
848850
git remote rename origin origin &&
849851
test_path_is_missing .git/branches/origin &&

t/t5516-fetch-push.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ test_expect_success 'fetch with branches' '
866866
mk_empty testrepo &&
867867
git branch second $the_first_commit &&
868868
git checkout second &&
869+
mkdir -p testrepo/.git/branches &&
869870
echo ".." > testrepo/.git/branches/branch1 &&
870871
(
871872
cd testrepo &&
@@ -879,6 +880,7 @@ test_expect_success 'fetch with branches' '
879880

880881
test_expect_success 'fetch with branches containing #' '
881882
mk_empty testrepo &&
883+
mkdir -p testrepo/.git/branches &&
882884
echo "..#second" > testrepo/.git/branches/branch2 &&
883885
(
884886
cd testrepo &&
@@ -893,6 +895,7 @@ test_expect_success 'fetch with branches containing #' '
893895
test_expect_success 'push with branches' '
894896
mk_empty testrepo &&
895897
git checkout second &&
898+
mkdir -p .git/branches &&
896899
echo "testrepo" > .git/branches/branch1 &&
897900
git push branch1 &&
898901
(
@@ -905,6 +908,7 @@ test_expect_success 'push with branches' '
905908

906909
test_expect_success 'push with branches containing #' '
907910
mk_empty testrepo &&
911+
mkdir -p .git/branches &&
908912
echo "testrepo#branch3" > .git/branches/branch2 &&
909913
git push branch2 &&
910914
(

0 commit comments

Comments
 (0)