git-tfs / git-tfs

A Git/TFS bridge, similar to git-svn
http://git-tfs.com/
Apache License 2.0
1.93k stars 718 forks source link

Nested branches, or multiple levels of branches #1430

Open PowerCoder opened 2 years ago

PowerCoder commented 2 years ago

I am not allowed to post the actual output (company policy) so I have to obfuscate it a bit. Please bear with me, I believe I can make it sufficiently clear.

I am attempting to clone a repository from TFS which has nested branches, or a branch of a branch.

Basically, this is what the git tfs branch -r looks like:

$/COM/Messages/MSG/Main -> default [*]
|
+- $/COM/Messages/MSG/BranchA
|  |
|  +- $/COM/Messages/MSG/BranchB

I cloned the repository up to the commit before BranchA was created (which is the final commit on main). I then do git tfs branch --init $/COM/Messages/MSG/BranchA and get the changesets belonging to that branch.

I then do git tfs branch --init $/COM/Messages/MSG/BranchB and this also pulls in the branch correctly with its changesets.

However, the second branch keeps getting initialized as main basically.

This is what the graph looks like: image

So the first branch gets branched off nicely in red, but the second one gets pasted right on top of main while it should branch off of the red branch instead. Or so it appears.

I also tried doing a checkout into the first branch and initializing from there, with the same result.

I also tried initializing all branches so it initialized them successively. Same thing happens.

Either this is not supported or I'm doing something wrong here. I wish I could blame VSCode but git log shows the same.

siprbaum commented 1 year ago

Sorry for the delay, I kind of missed this report. The redacted picture you have shown sadly doesn't tell which is which, e.g. perhaps to can fill out here?

o          # is this $/COM/Messages/MSG/BranchB
|
o
|
o
|     o     # is this $/COM/Messages/MSG/BranchA  ?
o    |
|   /
o
|
o
|
o
|
o        # is this $/COM/Messages/MSG/Main   ?

If my assumption above is correct with the branches, couldn't it be that BranchA was branched of $/COM/Messages/MSG/Main and without making any commit in BranchA the $/COM/Messages/MSG/BranchB was created.

Wouldn't then the above be a correct representation in GIT?