"re" configure? if you have 2 Git directories

Sep 25, 2013 at 7:31 PM
Edited Sep 25, 2013 at 7:33 PM
I have 2 different Git directories on my machine

Git Directory 1 is: c:\test1

I can run the following to confgure
c:\test1>git tf configure http://tfsserver:8080/tfs/TestProjectCollection $/dktest1/Source/Test1 --deep
Git Directory 2: c:\test2
I then try and configure another directory like so:
c:\test2>git tf configure http://tfsserver:8080/tfs/TestProjectCollection $/dktest1/Source/Test2 --deep
The Problem is it never "re" configures it to $/dktest1/Source/Test2 . It only stays on the $/dktest1/Source/Test1 directory and does not let me check in the code.


This is a big problem. Please let me know how I can "re" configure another directory
Developer
Sep 25, 2013 at 8:30 PM
Hi,

Probably you haven't explained precisely enough the steps you did.

Suppose I have two folders:
...\test1
...\test2
I go to one of them, initialize a Git repository, and configure Git-TF in it:
...\test1> git init .
...\test1> git tf configure http://Server:8080/tfs/Collection $/Project/Folder/Test1 --deep
Then I go to the second folder, initialize a Git repository, and configure Git-TF in it:
...\test2> git init .
...\test2> git tf configure http://Server:8080/tfs/Collection $/Project/Folder/Test2 --deep
After that I'm able to check-in commits from both Git repositories to corresponding folders:
...\test1>git tf checkin
Connecting to TFS...
Checking in to $/Collection/Folder/Test1: 100%, done.
Checked in 2 changesets, HEAD is changeset 11702

...\test2>git tf checkin
Connecting to TFS...
Checking in to $/Collection/Folder/Test2: 100%, done.
Checked in 3 changesets, HEAD is changeset 11705
What did you do differently? Probably, after you had created and configured Git repository in c:\test1 you copied in to c:\test2 ? That's why did you say "re-configure"? In this case you have to use the following option in your git tf configure command:
    --force, -f           Forces updating the server URI and server path (dangerous)
Alex
Sep 25, 2013 at 8:46 PM
I did the same steps you did. I did not "copy" the files from directory to another.

What I did do was "Clone" the same Git repository from a web based repository which should not make a difference.

so from the Git side I did

c:\test1>git clone http://somegitrepository/file.git

then

c:\test2>git clone http://somegitrepository/file.git

Then I ran the git-tf code as stated.

However the --force option seemed to work. Why is it dangerous? I am automating this process of 1. git from web based repository, checking into tfs, then building over and over again. If I always use --force what is the problem?
Developer
Sep 25, 2013 at 9:14 PM
Hi,

You may see in the .git subfolder of the repository the file git-tf. It describes mapping between commits in your Git repository and corresponding change sets in your TFS collection. If you arbitrary change the TFS target, the mapping might became invalid and Git-TF will start failing. But I still do not understand how it come that after you cloned to the second folder, i.e.
c:\test2>git clone http://somegitrepository/file.git 
it become "git-tf"-configured? The -- force option is needed only in the case the repository already has Git-TF configured in it, i.e. means the .git \config file contains:
[git-tf "server"]
    collection = ...
    serverpath = $/...
Did you see that?

Alex