Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle renames in TFS 2010 #9

Closed
wants to merge 2 commits into from

Conversation

olivierdagenais
Copy link

I was testing git-tfs against a TFS 2010 repository when it would mysteriously fail about halfway through the changesets with a NullReferenceException. I eventually traced the problem to the way TFS 2010 presents renames through the API. The short version is they no longer share an item ID. The long version is explained in this blog post I found:

http://blogs.msdn.com/b/michalma/archive/2009/06/15/version-control-api-changes-in-tfs-2010-part-i.aspx

I fixed the bug by adding a fallback that calls QueryHistory() with a very narrow search space and assume that anything returned must be the file's old name.

I also fixed a few other minor things and just noticed now that the line endings of the project files were probably updated, since almost the entire files are shown in the diffs. This is my first time using Git, so I might have configured something wrong on my end. Let me know if you need me to fix it.

Anyway, after this fix, git-tfs was able to go through the rest of the changesets in the TFS repository, so I guess it works. I mean, I'm able to subsequently clone the resulting git repo and I can browse the log to see an entry for each corresponding changeset in TFS, but again, new to Git, so I'm not sure what else I should be looking for.

Cheers,

  • Oli

Olivier Dagenais added 2 commits September 10, 2010 19:21
Explanation of the change is at http://blogs.msdn.com/b/michalma/archive/2009/06/15/version-control-api-changes-in-tfs-2010-part-i.aspx
1 - Added QueryWithHistory() method wrapper.
2 - TfsApiBridge.Wrap(Item) will now return null if the item supplied is null.
3 - TfsChangeset.GetPathBeforeRename() will now call QueryWithHistory() if GetItem() returned null.
4 - Fixed typo in parameter name.
@spraints
Copy link
Member

Thanks for the fix.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants