Skip to content

Commit c75d826

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 15503ac commit c75d826

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
@@ -811,6 +811,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
811811
(
812812
cd six &&
813813
git remote rm origin &&
814+
mkdir -p .git/branches &&
814815
echo "$origin_url" >.git/branches/origin &&
815816
git remote rename origin origin &&
816817
test_path_is_missing .git/branches/origin &&
@@ -825,6 +826,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
825826
(
826827
cd seven &&
827828
git remote rm origin &&
829+
mkdir -p .git/branches &&
828830
echo "quux#foom" > .git/branches/origin &&
829831
git remote rename origin origin &&
830832
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)