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

Update libgit2 #1298

Merged
merged 4 commits into from
Apr 12, 2016
Merged

Update libgit2 #1298

merged 4 commits into from
Apr 12, 2016

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented Apr 2, 2016

This depends on libgit2/libgit2#3724, as we were bombing one of the submodule status tests when looking for a submodule named sm_changed_head/ with a trailing slash. (Sigh.)

This uses the fancy new LibGit2Sharp.NativeBinaries where the native binaries now live in lib instead of NativeBinaries. That means that this should fix #1170. So please argue if you think this is a terrible idea.

Otherwise, once libgit2/libgit2#3724 is merged, I will reroll a new LibGit2Sharp.NativeBinaries nuget package and update this to use that.

Edward Thomson added 3 commits April 3, 2016 17:12
Update to NativeBinaries 1.0.137, update paths to `lib` from
`NativeBinaries`.  Update name of Windows 64-bit library to 'x64'
to reflect Microsoft's recommended naming.
Make GitWriteStream a struct instead of a class so that we can
accept a native `git_writestream`.  Use `git_blob_fromstream` to
stream data into a blob instead of the now-removed
`git_blob_fromchunks`.
@carlosmn
Copy link
Member

carlosmn commented Apr 5, 2016

The issue in #1170 AFAICT is mono prepending lib to the path instead of just the library name, so naming our path lib/ would make it load liblib/, no?

@ethomson
Copy link
Member Author

ethomson commented Apr 5, 2016

Pretty sure that the problem is that it prepends lib if it's not already there.

@ethomson
Copy link
Member Author

ethomson commented Apr 5, 2016

But yeah let's validate this before we merge this. I hate changing the name if it's not going to work.

@asbjornu
Copy link

asbjornu commented Apr 6, 2016

Can't you please merge this into an unstable branch and release it as a prerelease package on NuGet? That way, I can update to the prerelease package in GitTools/GitVersion#816 and confirm whether the changes fixes DllNotFoundException on Mono or not.

@ethomson
Copy link
Member Author

ethomson commented Apr 6, 2016

@asbjornu Please try this nuget package:

LibGit2Sharp.0.23.0-dev00000000000000.zip

@ethomson
Copy link
Member Author

@asbjornu Are you able to test this?

@bording
Copy link
Member

bording commented Apr 12, 2016

@ethomson I just downloaded the file you linked so I could try it out myself, but it looks like that package only has the windows native binaries included!

@ethomson
Copy link
Member Author

Oh FFS. I'll rev the libgit2 version without this libs change so that we can actually make progress on other things.

@ethomson
Copy link
Member Author

@bording I see all the platforms in the NativeBinaries package that the aforementioned nupkg references:

% unzip -l ../libgit2sharp.nativebinaries.1.0.137.nupkg
Archive:  ../libgit2sharp.nativebinaries.1.0.137.nupkg
  Length     Date   Time    Name
 --------    ----   ----    ----
      512  04-03-16 11:19   _rels/.rels
      706  04-03-16 11:19   LibGit2Sharp.NativeBinaries.nuspec
     2572  04-03-16 11:19   build/LibGit2Sharp.NativeBinaries.props
    48319  04-03-16 11:19   libgit2/libgit2.license.txt
      252  04-03-16 11:19   libgit2/LibGit2Sharp.dll.config
       13  04-03-16 11:19   libgit2/libgit2_filename.txt
       41  04-03-16 11:19   libgit2/libgit2_hash.txt
  1150658  04-03-16 11:19   libgit2/linux/x86_64/libgit2-381caf5.so
  1612844  04-03-16 11:19   libgit2/osx/libgit2-381caf5.dylib
  1087488  04-03-16 11:19   libgit2/win32/x64/git2-381caf5.dll
  5943296  04-03-16 11:19   libgit2/win32/x64/git2-381caf5.pdb
   817664  04-03-16 11:19   libgit2/win32/x86/git2-381caf5.dll
  5926912  04-03-16 11:19   libgit2/win32/x86/git2-381caf5.pdb
      653  04-03-16 11:19   package/services/metadata/core-properties/930b68e187c84cb790e7594988adfbee.psmdcp
      808  04-03-16 11:19   [Content_Types].xml
 --------                   -------
 16592738                   15 files

@bording
Copy link
Member

bording commented Apr 12, 2016

@ethomson Ugh, nevermind, I'm dumb. Sorry for the trouble. I was looking at the wrong package. 😦

Let me test this real quick.

@bording
Copy link
Member

bording commented Apr 12, 2016

Ok, I just created a quick sample and this looks to be working perfectly. I was able to successfully run my sample in Ubuntu while my current directory was not the same directory as the program!

👍 This change works!

@ethomson
Copy link
Member Author

Thanks @bording ! 👯

@carlosmn carlosmn merged commit 63771c5 into libgit2:master Apr 12, 2016
@asbjornu
Copy link

Due to NuGet/Home#1874, I'm unable to update this on OS X, but I'm setting up a Windows VM to perform the necessary nuget commands now so we can see how everything flies on OS X after this upgrade. Fingers crossed!

@asbjornu
Copy link

I've managed to update to your custom built package, @ethomson (as well as to NativeBinaries version 1.0.137) and this is the result on my end:

System.TypeInitializationException : The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
  ----> System.DllNotFoundException : NativeBinaries/osx/libgit2-785d8c4.dylib
   at LibGit2Sharp.Core.Proxy.git_repository_init_ext (LibGit2Sharp.Core.FilePath workdirPath, LibGit2Sharp.Core.FilePath gitdirPath, Boolean isBare) in <filename unknown>:line 0
   at LibGit2Sharp.Repository.Init (System.String path, Boolean isBare) in <filename unknown>:line 0
   at LibGit2Sharp.Repository.Init (System.String path) in <filename unknown>:line 0
   at GitTools.Testing.EmptyRepositoryFixture.CreateNewRepository (System.String path) in <filename unknown>:line 0
   at GitTools.Testing.RepositoryFixtureBase..ctor (System.Func`2 repoBuilder) in <filename unknown>:line 0
   at GitTools.Testing.EmptyRepositoryFixture..ctor () in <filename unknown>:line 0
   at PullRequestInTeamCityTest.GivenARemoteWithATagOnMaster_AndAPullRequestWithTwoCommits_AndBuildIsRunningInTeamCity_VersionIsCalculatedProperly (System.String pullRequestRef) in <filename unknown>:line 0
   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in <filename unknown>:line 0
--DllNotFoundException
   at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
   at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () in <filename unknown>:line 0
   at LibGit2Sharp.Core.NativeMethods..cctor () in <filename unknown>:line 0

@asbjornu
Copy link

I'm not sure what the path NativeBinaries/osx/libgit2-785d8c4.dylib is referring to, but I do find a similarly named file here: ./packages/LibGit2Sharp.NativeBinaries.1.0.137/libgit2/osx/libgit2-381caf5.dylib.

@bording
Copy link
Member

bording commented Apr 13, 2016

@asbjornu If your code is still looking for NativeBinaries/osx/libgit2-785d8c4.dylib then it looks like you aren't actually using the new version of LibGit2Sharp.dll that was included in the package linked in this issue.

@asbjornu
Copy link

@bording Yes, indeed. After a thorough clean and rebuild, it now seems to be working! When can I expect to see version 0.23.0 out on NuGet? 😄

@asbjornu
Copy link

@ethomson @carlosmn @nulltoken Anyone? A release of this on NuGet is the only thing I need now to get GitVersion working on Mono. 😄

@carlosmn
Copy link
Member

Version 0.23.0 of libgit2sharp will likely come at the same time as the next libgit2 release in a few months.

@asbjornu
Copy link

@carlosmn Ah, ok. Any chance of a pre-release on NuGet until then? It's a bit hard to change the reference from an external one on NuGet to a local one.

asbjornu added a commit to Pomona/Pomona that referenced this pull request Apr 19, 2016
Add a conditional on the GitVersionTask import so it's not imported on Unix, until GitTools/GitVersion#816 is fixed through a (pre-) release of libgit2/libgit2sharp#1298 on NuGet.
asbjornu added a commit to Pomona/Pomona that referenced this pull request Apr 19, 2016
Add a conditional on the GitVersionTask import so it's not imported on Unix, until GitTools/GitVersion#816 is fixed through a (pre-) release of libgit2/libgit2sharp#1298 on NuGet.
@ethomson
Copy link
Member Author

@asbjornu
Copy link

@ethomson Brilliant, thanks!

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.

DllNotFoundException on Mono Linux
4 participants