Trying to understand git-tfs clone --branches=none

481 views
Skip to first unread message

Lars Ruoff

unread,
Nov 25, 2021, 12:42:53 PM11/25/21
to git-t...@googlegroups.com
Hello,
I have a hard time understanding the --branches=none option of git-tfs clone.
It says
  Ignore branches and merge changesets,
fetching only the clone tfs path.

Let's assume we clone the default branch with --branches=none.

What I don't understand is how individual merge changesets can be ignored.
What happens to the changes we are omitting to do on the target (default) branch?
If it is missing, how can the resulting code possibly work?
Especially since multiple omits are likely to add up and produce something that is completely unrelated to the original changesets of the TFS default branch.

I'm certainly missing something, but what I'd expected is that the merge changesets themselves are taken (they've been checked-in on the target branch after all), but then we should not take *other* changesets from that source branch.

Can you help to explain the choice behind ignoring merge changesets?
regards,
Lars R.

Philippe Miossec

unread,
Nov 25, 2021, 1:13:26 PM11/25/21
to git-tfs-dev
This option is to instruct git-tfs not to try to support branches (and so also fetch other branches merged into the one you clone) and instead to create a git repository based on the "folder" in TFVC you pass to it.

It's more a "directory" clone (as it was only available in TFVC <2008) than a "Branch" clone.

> I'm certainly missing something, but what I'd expected is that the merge changesets themselves are taken (they've been checked-in on the target branch after all), but then we should not take *other* changesets from that source branch.

As you understand well, merge changesets are taken but doesn't trigger the fetch of changesets from the branch merged. We only fetch the content of the files merged.

I hope it answer to all your questions.

Peter Baumann

unread,
Nov 26, 2021, 1:32:42 AM11/26/21
to git-t...@googlegroups.com
See answer inline:
Your expectation is correct, the content of the merge is taken, but
not the branches.

The following ist best viewed in fixed with fonts.
So if you history in TFS would look like

a - b - c - m - x - y $/project/Main
/
1 - 2 - 3 $/project/Branches/Dev

then the resulting clone with --branches=none of /$project/Main would look like

a - b - c - m - x - y in git

Regards,
Peter

Lars Ruoff

unread,
Nov 26, 2021, 3:14:13 AM11/26/21
to git-t...@googlegroups.com
Ok, thanks a lot!
That's indeed what I expected.
It's the "Ignore merge changesets" description that got me confused.

--
You received this message because you are subscribed to the Google Groups "git-tfs-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to git-tfs-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/git-tfs-dev/CAJm9OHeyZBmvpN1CrNn5V60ZjGz5y73do-Nw6wK2CLh7ZEHxew%40mail.gmail.com.

Lars Ruoff

unread,
Nov 26, 2021, 4:04:33 AM11/26/21
to git-t...@googlegroups.com
oh, one more question,
if merging with --branches=auto,
will it only fetch branch changesets up to the point of last merge or beyond?
That is, if the TFS history would look like this:


a - b - c - m - x - y    $/project/Main
           /
1 - 2 - 3  - 4 - 5       $/project/Branches/Dev

Will the clone include changesets 4 and 5 of the merged branch?

Peter Baumann

unread,
Nov 26, 2021, 6:43:22 AM11/26/21
to git-t...@googlegroups.com
To the best of my knowledge (but I haven't tried it), it will not
fetch the changesets 4 and 5, but it will register the $/project/Branches/Dev
as a branch.

You can then decide if you fetch all registered branches (via `git tfs
fetch --all`)
or just the a specific one. See git-tfs fetch documentation for details.

-Peter

Lars Ruoff

unread,
Nov 30, 2021, 10:59:22 AM11/30/21
to git-t...@googlegroups.com
thanks.
I confirmed by experiment that CS 4 and 5 will not be fetched during the clone.

Other question:
How do I ignore several branches during clone?
Can there be multiple --ignore-branches-regex=xxx or do I need to construct some OR-logic with regexps?
I'm currently trying with multiple occurrences, but it's been running for suspiciously long (>24h) already with no result. :(

Lars R.

--
You received this message because you are subscribed to the Google Groups "git-tfs-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to git-tfs-dev...@googlegroups.com.

Peter Baumann

unread,
Nov 30, 2021, 11:39:19 AM11/30/21
to git-t...@googlegroups.com
On Tue, Nov 30, 2021 at 4:59 PM Lars Ruoff <l...@qad.com> wrote:
>
> thanks.
> I confirmed by experiment that CS 4 and 5 will not be fetched during the clone.
>
> Other question:
> How do I ignore several branches during clone?
> Can there be multiple --ignore-branches-regex=xxx or do I need to construct some OR-logic with regexps?

AFAIK it needs to be one regex. It is at least stored as one regex in
the .git/config,
see https://github.com/git-tfs/git-tfs/blob/72f3f79584f467910b7dd3b738cd37c25c4a89e0/src/GitTfs/Core/GitTfsRemote.cs#L646

But I haven't used that feature
> To view this discussion on the web visit https://groups.google.com/d/msgid/git-tfs-dev/CANWCJmJnLPAyG0NsiO-1aG7nagXVFYuV4g6kyWdF_hYSs5D_gQ%40mail.gmail.com.

Lars Ruoff

unread,
Dec 1, 2021, 12:02:30 PM12/1/21
to git-t...@googlegroups.com
It doesn't seem to work even for a single exclusion:

>git tfs clone [url] [tfstrunk] xa --bare -c=53834 --ignore-branches-regex='21\.0\.0'
Found matching Visual Studio version at C:\Program Files (x86)\Microsoft Visual Studio\2019\TeamExplorer
Initialized empty Git repository in C:/GitRepos/xa/

Fetching from TFS remote 'default'...
1 objects created...
C53834 = dd30e36d88a466fe5b65bbd3252a2527c10ad69a
C53843 = 4c3c4ef27cc53054a9a9572cfd259ab7c43f1802
C53844 = 057b22f3c21b57c96f1837152e4625ac8d6200dc
C53845 = dc5ead0aa4dbff5a0a87d5bab95caa98acc83262
C53846 = 9099392f1a8018f82ece7193087b1ed6f090089f
C53847 = 3aef4cae6dc947d6456742cd1c2623ec576eef5c
C53848 = 6e6b67fa006b2af7861315fbfbe75e685db9b9ed
C53849 = e476c248ae9f9e219be9d19bfc918993f6e133bd
C53850 = 9b9df59d1e834909b72fd889a7fa48b545800dbe
C53852 = d7b3f6ab9959a1d15148876f0c508b1dcc2eab60
The name of the local branch will be : 21.0.0
warning: root commit not found corresponding to changeset 50217
=> continuing anyway by creating a branch without parent...
The name of the local branch will be : 21.0.0
        Fetching from dependent TFS remote '21.0.0'...
?

Lars Ruoff

unread,
Dec 2, 2021, 3:23:33 AM12/2/21
to git-t...@googlegroups.com
works with  --ignore-branches-regex=21\.0\.0 ! (without the quotes) - My bad!

Reply all
Reply to author
Forward
0 new messages