-
Notifications
You must be signed in to change notification settings - Fork 714
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
init-branch fails with NullReferenceException #374
Comments
Unfortunately the stacktrace is of no help. Perhaps, if you could jump in, fetch the sources of git-tfs, compile and run it to get more informations, it will help us a lot. I have a little idea of what happens : the method You say that you already successfully init-branches. Was it on this TFS folder or on another? I don't see exactly what is the problem and don't know exactly how to solve this problem appart from detecting this problem and preventing git-tfs to crash. You surely have to find what is the problem yourself before we could try to fix it... |
Sorry. Yes, init branches was done on other TFS Branches in the same repo. This one (Iteration50) always failed. I shall endeavour to pull the source and debug it for more information. |
I too having the same problem. I've originally cloned a branch, but now I'd like to get the main/parent of the current branch and I hit this problem. not sure if this is actually the cause. $ git tfs branch -d --init $/xxx/xyz main
git-tfs version 0.17.1.0 (TFS client library 10.0.0.0 (MS)) (32-bit)
No authors file used.
=> Working on TFS branch : $/xxx/xyz
The name of the local branch will be : main
Git local branch will be :main
Looking for all branches...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Sep.Git.Tfs.VsCommon.TfsHelperVs2010Base.GetRootChangesetForBranch(String tfsPathBranchToCreate, String tfsPathParentBranch)
at Sep.Git.Tfs.Commands.InitBranch.CreateBranch(IGitTfsRemote defaultRemote, String tfsRepositoryPath, IEnumerable`1 allRemotes, String gitBranchNameExpected, String tfsRepositoryPathParentBranch)
at Sep.Git.Tfs.Commands.InitBranch.Run(String tfsBranchPath, String gitBranchNameExpected)
at Sep.Git.Tfs.Commands.Branch.Run(String param1, String param2)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
at Sep.Git.Tfs.GitTfs.Run(IList`1 args)
at Sep.Git.Tfs.Program.MainCore(String[] args)
at Sep.Git.Tfs.Program.Main(String[] args)
Object reference not set to an instance of an object. |
I have added trace log to help find out what is the problem and prevent the crash on a null reference. @SimplyGed @cincauhangus : https://github.com/pmiossec/git-tfs/tree/debug_init_branch but @cincauhangus , your problem should come from the fact that you can't init a branch that is the parent off your |
I was guessing that too as I was trying to branch off a quick-clone repo I received that error. This is probably off topic already but is there a way to clone starting from a specific changeset? Like this SO question: http://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset Harddisk space is a luxury here and cloning the entire repo is going to make me useless for the entire day (est 8 hours to clone entire repo).. |
I never used it, but should work, there is an option for that on and after you do a fetch that should fetch the history starting from this changeset. |
👍 @pmiossec Thanks! will try it out. Update: |
@cincauhangus If you have quite some times, I would be very happy if you could test the version with debug trace to track this null reference! Like that we could fix that bug... |
Sure, will give it a try once I've finished cloning the repo. |
👍 Thanks a lot 👍 ;) |
Can't reproduce this issue after i've recloned my repo. It's probably the reason you mentioned earlier in #374 (comment) |
I'm quite sure that was the problem. You tried to init the 'trunk' branch and when we init a branch, we try to find its parent. There is no so there is a null ref exception. |
I think would also be helpful to display the changeset id of the root of each branch. For my case, I wanted to to get the trunk without cloning the entire repo (7000~ checkins) to sync up a branch with the trunk. Had to reclone 3 times to finally get the changeset id i needed to have both the trunk and the branch changesets. Using Not sure if there's a way to add older changesets to an existing repo if you did a Anyways, my problem's solved. 👍 |
the (initial) problem of @cincauhangus should be corrected by #390 @SimplyGed if you could (and anyone having that crash in the future) test with this version : |
The debug trace shows the same stacktrace as before. tfsPathParentBranch = tfsBranchToCreate.Properties.ParentBranch.Item; The ParentBranch object is NULL |
The problem from the TFS pov is that the branch was done for subfolder, not the parent that has been marked as the branch. E.G. /Branch/Project Someone branched the mainline to "Project" whereas they should have done it at "Branch". But "Branch" has been marked as the branch folder and that is what I am trying to init. I'm not going to be able to solve this and will probably leave it be, but the GitTfs tool should probably ensure the ParentBranch is not NULL before trying to access the Item property. Thanks for help with this |
Yes that's what I understand and that's what I have corrected with the pull
|
Was that meant to be in the code I pulled and tested? |
If you pull my pull request branch or the debug branch I tell you to test, PS: TFS permit so much strange things that we don't have enough imagination
|
OK. My bad. I'll get the debug branch and give it a test. Thanks again for your help! |
I keep getting an error when attempting to execute init-branch on an existing TFS branch. It The branch I am tring to init was originally created as a folder in TFS, then the code was branched (from master), then the branch was converted to a TFS Branch.
This is similar to a closed issue (#304) but my branch has a parent and it has commits (~20). I am able to reproduce this issue consistently with the current 0.17.1 build (I am using the prebuilt binaries).
I have managed to init other branches without issue.
If you need any more information, let me know.
Command line:
The stacktrace is:
The text was updated successfully, but these errors were encountered: