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 <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2016-11-30 12:00:59 +01:00
parent 0138d84c37
commit 4e9cc39d5d
2 changed files with 6 additions and 0 deletions

View File

@@ -824,6 +824,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
(
cd six &&
git remote rm origin &&
mkdir -p .git/branches &&
echo "$origin_url" >.git/branches/origin &&
git remote rename origin origin &&
test_path_is_missing .git/branches/origin &&
@@ -838,6 +839,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
(
cd seven &&
git remote rm origin &&
mkdir -p .git/branches &&
echo "quux#foom" > .git/branches/origin &&
git remote rename origin origin &&
test_path_is_missing .git/branches/origin &&

View File

@@ -866,6 +866,7 @@ test_expect_success 'fetch with branches' '
mk_empty testrepo &&
git branch second $the_first_commit &&
git checkout second &&
mkdir -p testrepo/.git/branches &&
echo ".." > testrepo/.git/branches/branch1 &&
(
cd testrepo &&
@@ -879,6 +880,7 @@ test_expect_success 'fetch with branches' '
test_expect_success 'fetch with branches containing #' '
mk_empty testrepo &&
mkdir -p testrepo/.git/branches &&
echo "..#second" > testrepo/.git/branches/branch2 &&
(
cd testrepo &&
@@ -893,6 +895,7 @@ test_expect_success 'fetch with branches containing #' '
test_expect_success 'push with branches' '
mk_empty testrepo &&
git checkout second &&
mkdir -p .git/branches &&
echo "testrepo" > .git/branches/branch1 &&
git push branch1 &&
(
@@ -905,6 +908,7 @@ test_expect_success 'push with branches' '
test_expect_success 'push with branches containing #' '
mk_empty testrepo &&
mkdir -p .git/branches &&
echo "testrepo#branch3" > .git/branches/branch2 &&
git push branch2 &&
(