Bug 8255 - NullReferenceException on checking out git repository
Summary: NullReferenceException on checking out git repository
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-11-07 04:24 UTC by Atsushi Eno
Modified: 2012-11-14 08:51 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Atsushi Eno 2012-11-07 04:24:48 UTC
This is different from bug #5894, I'm getting different NullReferenceException on checking out git repository (at least I could reproduce this for codeplex and github https repos).

repro:
- start md
- checkout https://git01.codeplex.com/rx for example

System.NullReferenceException: Object reference not set to an instance of an object
  at NGit.Api.CloneCommand.Init (NGit.Transport.URIish u) [0x00037] in /svn/monodevelop-master/main/external/ngit/NGit/NGit.Api/CloneCommand.cs:137 
  at NGit.Api.CloneCommand.Call () [0x0000e] in /svn/monodevelop-master/main/external/ngit/NGit/NGit.Api/CloneCommand.cs:109 
  at MonoDevelop.VersionControl.Git.GitRepository.Checkout (FilePath targetLocalPath, MonoDevelop.VersionControl.Revision rev, Boolean recurse, IProgressMonitor monitor) [0x00050] in /svn/monodevelop-master/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:699 
  at MonoDevelop.VersionControl.CheckoutWorker.Run () [0x00007] in /svn/monodevelop-master/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs:55 
  at MonoDevelop.VersionControl.Task.BackgroundWorker (System.Object state) [0x00002] in /svn/monodevelop-master/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Task.cs:49
Comment 1 Alan McGovern 2012-11-07 06:58:07 UTC
I get this error:

NGit.Api.Errors.InvalidRemoteException: Invalid remote: origin ---> NGit.Errors.NoRemoteRepositoryException: https://git01.codeplex.com/rx : https://git01.codeplex.com/rx /info/refs?service=git-upload-pack not found
  at NGit.Transport.TransportHttp.Connect (System.String service) [0x00158] in /Users/alan/Projects/monodevelop/main/external/ngit/NGit/NGit.Transport/TransportHttp.cs:558 
  --- End of inner exception stack trace ---
  at NGit.Api.FetchCommand.Call () [0x00093] in /Users/alan/Projects/monodevelop/main/external/ngit/NGit/NGit.Api/FetchCommand.cs:139 
  at NGit.Api.CloneCommand.Fetch (NGit.Repository clonedRepo, NGit.Transport.URIish u) [0x000d5] in /Users/alan/Projects/monodevelop/main/external/ngit/NGit/NGit.Api/CloneCommand.cs:171 
  at NGit.Api.CloneCommand.Call () [0x00014] in /Users/alan/Projects/monodevelop/main/external/ngit/NGit/NGit.Api/CloneCommand.cs:110 
  at MonoDevelop.VersionControl.Git.GitRepository.OnCheckout (FilePath targetLocalPath, MonoDevelop.VersionControl.Revision rev, Boolean recurse, IProgressMonitor monitor) [0x0004e] in /Users/alan/Projects/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:699 
  at MonoDevelop.VersionControl.Repository.Checkout (FilePath targetLocalPath, MonoDevelop.VersionControl.Revision rev, Boolean recurse, IProgressMonitor monitor) [0x00007] in /Users/alan/Projects/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs:419 
  at MonoDevelop.VersionControl.CheckoutWorker.Run () [0x00006] in /Users/alan/Projects/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs:56 
  at MonoDevelop.VersionControl.Task.BackgroundWorker (System.Object state) [0x00000] in /Users/alan/Projects/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Task.cs:52
Comment 2 Atsushi Eno 2012-11-07 07:39:55 UTC
It looks like codeplex is problematic, I see a lot of issue reports on codeplex site complaining that it fails with HTTP error.
Try https://github.com/atsushieno/mmm.git instead. It still results in NRE.

But it seems that the result depends on the destination directory (non-existent, empty, non-empty)
Comment 3 Alan McGovern 2012-11-14 08:51:15 UTC
I fixed the null reference exception. It's a bug in jgit due to lack of error check on their part. I'll report the issue upstream but for now we should get a proper error message when we hit the error case. The error was that if you choose to clone to a path and a file already existed in that path (i.e the path is a file, not an existing directory or whatever) you would get that NullReferenceException.

I still need to investigate why the https url is not working, but it looks like it's not the fault of ngit/jgit so closing this now.