Skip to content

Commit

Permalink
t5505,t5516: create .git/branches/ when needed
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dscho authored and jamill committed Sep 5, 2018
1 parent 539b165 commit e7ac03b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/t5505-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand Down
4 changes: 4 additions & 0 deletions t/t5516-fetch-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand All @@ -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 &&
(
Expand All @@ -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 &&
(
Expand Down

0 comments on commit e7ac03b

Please sign in to comment.