Closed asinning closed 2 years ago
Just like #45, that's by design. This is how git works. Most of these things are inevitable. I'm gonna close this as WONTFIX.
$ git init
Initialized empty Git repository in /private/tmp/test/.git/
$ git commit --allow-empty -m root
[master (root-commit) 7fb585d] root
$ git checkout -b foo
Switched to a new branch 'foo'
$ git checkout -b foo/bar
fatal: cannot lock ref 'refs/heads/foo/bar': 'refs/heads/foo' exists; cannot create 'refs/heads/foo/bar'
$ tree .git/refs/
.git/refs/
├── heads
│ ├── foo
│ └── master
└── tags
2 directories, 2 files
This is a git problem, not a tomono problem. You'd have to solve this in your source repos.
Background:
Git stores all branches as files under .git/refs/heads
, so if you have a branch foo/bar
it becomes "folder foo
with file bar
", if you then want to create a branch foo
, it would try to create a file foo
next to existing folder foo
, which won't work.
Example:
$ git init
Initialized empty Git repository in /private/tmp/test/.git/
$ git commit --allow-empty -m root
[master (root-commit) 7fb585d] root
$ git checkout -b foo
Switched to a new branch 'foo'
$ git checkout -b foo/bar
fatal: cannot lock ref 'refs/heads/foo/bar': 'refs/heads/foo' exists; cannot create 'refs/heads/foo/bar'
$ tree .git/refs/
.git/refs/
├── heads
│ ├── foo
│ └── master
└── tags
2 directories, 2 files
$ cat .git/refs/heads/foo
7fb585dc7d0d40e7d66f8b55a5cc3ba454f1b777
$ git checkout master
Switched to branch 'master'
$ git branch -d foo
Deleted branch foo (was 7fb585d).
$ git checkout -b foo/bar
Switched to a new branch 'foo/bar'
$ tree .git/refs
.git/refs
├── heads
│ ├── foo
│ │ └── bar
│ └── master
└── tags
3 directories, 2 files
$ cat .git/refs/heads/foo/bar
7fb585dc7d0d40e7d66f8b55a5cc3ba454f1b777
If one repository has a branch having a name which matches the left-hand folder-path of a branch in another repository, then the merge will fail.