GithubHelp home page GithubHelp logo

ngit's Introduction

ABOUT NGIT
----------

NGit is a port of JGit [1] to C#. This port is generated semi-automatically
using Sharpen [2], a Java-to-C# conversion utility.

NGit provides all functionality implemented by JGit, including all repository
manipulation primitives and transport protocols. SSH support is provided by
a port of jsch [3], included in the project.

The project is composed by 4 libraries:
- NGit: The git library.
- NGit.Test: Unit tests for NGit
- NSch: The port of jsch.
- Sharpen: Some support classes required by the above libraries.

The code included in this project is already converted, so to use it
you just have to open the ngit.sln solution and build it.

Instructions and tools for updating and regenerating the NGit code from JGit
are available in the 'gen' subdirectory.

COMPILING
---------
The port depends on two external libraries:
  - ICSharpCode.SharpZipLib
  - Mono.Security
  - Mono.Posix (optional)

If you are compiling with Mono then these libraries will be available in
Mono's GAC. If you are compiling on Windows using the Microsoft .NET
framework you can obtain these libraries by installing the Mono Libraries
package:
  http://monodevelop.com/files/Windows/MonoLibraries.msi

The optional Mono.Posix assembly can be gotten by installing Gtk# for windows.
The latest installer can usually be found on the monodevelop site:
  http://monodevelop.com/Download

Mono.Posix is only required when building the Sharpen.Unix assembly, and this
assembly is only required when running NGit on MacOS or Linux operating system.
If you are only running on Windows, then you do not need to compile this assembly.
Sharpen.Unix only contains support code to correctly handle symlinks on Unix
based systems.

CREDITS
-------

Credits on the code should go to the authors of jgit, jsch and Sharpen
(see links below).

The support Sharpen library has been implemented by Lluis Sanchez ([email protected])

[1] http://eclipse.org/jgit
[2] http://developer.db4o.com/Projects/html/projectspaces/db4o_product_design/sharpen.html
[3] http://www.jcraft.com/jsch

ngit's People

Contributors

alanmcgovern avatar bojanrajkovic avatar damageboy avatar fealebenpae avatar jstedfast avatar linquize avatar sharwell avatar slluis avatar terrajobst avatar therzok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngit's Issues

Sharpen.FilePath.Delete() failing randomly in NGit.Test tests

I successfully compiled in Visual Studio 2010, Windows 7 x64, .NET 4.0.

Trying to run all the tests in the NGit.Test project, I randomly get an IOException when trying to delete a temporary file. Here's an example:

***** NGit.Api.CheckoutCommandTest.TestCheckoutWithNonDeletedFiles
System.IO.IOException: The process cannot access the file 'C:\Users\dprothero\Documents\GitHub\ngit\bin\target\trash\test1341438627296_62\temp' because it is being used by another process.
at Sharpen.FilePath.Delete() in C:\Users\dprothero\Documents\GitHub\ngit\Sharpen\Sharpen\FilePath.cs:line 148
System.IO.IOException: The process cannot access the file 'C:\Users\dprothero\Documents\GitHub\ngit\bin\target\trash\test1341438627296_62\Test.txt' because it is being used by another process.
at Sharpen.FilePath.Delete() in C:\Users\dprothero\Documents\GitHub\ngit\Sharpen\Sharpen\FilePath.cs:line 148

I can re-run the test and it'll pass, but another one will fail.

David

Incorrect topological sorting

Enountered an issue with Topological log rendering by latest version of ngit sources, built in VS 2010.

Given a simple history of two merged branches:

$ git log --graph --oneline
*   ba81db5 Merge branch 'new'
|\
| * 7f032bd Commit #5
| * fe2dd30 Commit #3
* | efda135 Commit #4
* | 116839d Commit #2
|/
* 089e538 commit #1

I'm trying to render it in the same way using NGit using the following code:

class Program
{
    static void Main(string[] args)
    {
        var r = new FileRepository(@"D:\temp\_git\.git");
        var headId = r.Resolve(Constants.HEAD);
        var rw = new RevWalk(r);
        rw.Sort(RevSort.TOPO);
        rw.MarkStart(rw.LookupCommit(headId));
        RevCommit c;
        while((c = rw.Next()) != null)
        {
            Console.WriteLine("{0}, {2}, {1}", c.Abbreviate(8).Name, c.GetShortMessage(), UnixTimeStampToDateTime(c.CommitTime));
        }
    }
    public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
    {
        // Unix timestamp is seconds past epoch
        var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
        dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
        return dtDateTime;
    }
}

Which unexpectedly gives me commit-time ordering.

ba81db55, 3/8/2013 1:16:54 PM, Merge branch 'new'
7f032bdc, 3/8/2013 1:16:05 PM, Commit #5
efda135c, 3/8/2013 1:15:29 PM, Commit #4
fe2dd30d, 3/8/2013 1:14:58 PM, Commit #3
116839d4, 3/8/2013 1:13:52 PM, Commit #2
089e5381, 3/8/2013 1:12:54 PM, commit #1

Probably there is a known issue - anyway, please let me know if it would be fixed. (I'm going to use ngit for some automation, but topo-order is critical to me).

ObjectDirectory.GetDirectory() should be Public

The GetDirectory() method of the ObjectDirectory class is set as internal: https://github.com/mono/ngit/blob/master/NGit/NGit.Storage.File/ObjectDirectory.cs#L151

But it should be public:
http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java#n172

Also applies for fileFor(AnyObjectId).

I need this methods for some tasks.

I am currently using this (very very dirty) Workaround:

string path = objectDirectory.ToString();
path = path.Substring(16, path.Length - 17);

ToString() delivers "ObjectDirectory[" + GetDirectory() + "]". That way it's possible to extract the path.

Solution doesn't build out of the box

Projects reference libs (ICSharpCode.SharpZipLib, Mono.Security, Nunit) that cannot be found. I suggest putting these dependencies in a \lib folder. I will do a PR if you concur.

Port forwarding does not work

I created a console app with NSch.dll and the required Sharpen and Mono dlls. It can connect to the SSH server (from Windows 7 to Debian), but cannot forward remote port 10080 to my local machine's port 8080. However, reverse tunneling does work: it can forward my local port 10080 to remote port 8080.

var session = jsch.GetSession("root", "192.168.1.136", 22);
session.SetPassword("password");
session.SetConfig("StrictHostKeyChecking", "no");
session.Connect();

//works. I get back the server version.
Console.WriteLine("SSH Server: " + session.GetServerVersion());

int assignedPort = session.SetPortForwardingL(8080, "192.168.1.136", 10080);
//does not work, although I properly get back the assigned port.
Console.WriteLine("Assigned Port: " + assignedPort);

//works fine.
session.SetPortForwardingR(8080, "localhost", 10080);

Is this a bug or I am doing something wrong?

Karl

Algorithm negotiation fail

Exception: "[email protected]:username/project.git: Algorithm negotiation fail"
Code:

public class CustomConfigSessionFactory : JschConfigSessionFactory
{
public string PrivateKey { get; set; }
public string PublicKey { get; set; }

protected override void Configure(OpenSshConfig.Host hc, Session session)
{
     var config = new Properties();
     config["StrictHostKeyChecking"] = "no";
     config["PreferredAuthentications"] = "publickey";
     session.SetConfig(config);

     var jsch = this.GetJSch(hc, FS.DETECTED);
     jsch.AddIdentity("KeyPair", Encoding.UTF8.GetBytes(PrivateKey), Encoding.UTF8.GetBytes(PublicKey), Encoding.UTF8.GetBytes("netbrain"));
}

}

var customConfigSessionFactory = new CustomConfigSessionFactory();
customConfigSessionFactory.PrivateKey = File.ReadAllText(@"D:\id_rsa");
customConfigSessionFactory.PublicKey = File.ReadAllText(@"D:\id_rsa.pub");

NGit.Transport.JschConfigSessionFactory.SetInstance(customConfigSessionFactory);
var git = NGit.Api.Git.CloneRepository()
.SetDirectory(new Sharpen.FilePath(@"d:\abcde"))
.SetURI("[email protected]:username/project.git")
.Call();

NGit library hangs at application shutdown (_object_87::~_object_87 never called)

BatchingProgressMonitor's alarmQueue is preventing application exit with NGit.

The destructor of _object_87 is never called, causing the thread pool (alarmQueue in BatchingProgressMonitor) to hang indefinitely.

I have proof-of-concepted a workaround based on calling alarmQueue.ShutdownNow() explicitely, see here

http://stackoverflow.com/questions/6310691/some-ngit-stuff-prevents-c-application-from-shutting-down-correctly/6311193#6311193

Minimal failing example:

using System;
using NGit;
using NGit.Api;
using NGit.Transport;

namespace Stacko
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Git myrepo = Git.Init().SetDirectory(@"/tmp/myrepo.git").SetBare(true).Call();
            {
                var fetchResult = myrepo.Fetch()
                    .SetProgressMonitor(new TextProgressMonitor())
                    .SetRemote(@"/tmp/initial")
                    .SetRefSpecs(new RefSpec("refs/heads/master:refs/heads/master"))
                    .Call();
                //
                // Some other work...
                //
                myrepo.GetRepository().Close();
            }
            System.GC.Collect();

#if false
            System.Console.WriteLine("Killing");
            BatchingProgressMonitor.ShutdownNow();
#endif
            System.Console.WriteLine("Done");

        }
    }
}

using the helper in BatchingProgressMonitor:

public static void ShutdownNow()
{
    alarmQueue.ShutdownNow();
}

Tested platforms:

  1. Linux (Mono 2.6.7, .NET 3.5)
  2. Linux (Mono 2.11, .NET 4.0)

Cannot add HEAD to a bundle

I want to create a bundle with the BundleWriter class. I can add branches to the bundle, but adding the current HEAD (which is neccesary to actually pull from a bundle) does not work. The following code

using System;
using NGit;
using NGit.Storage.File;
using NGit.Transport;

public static class M
{
  static void Main()
  {
    string workingDir = "/tmp/gittestdir";
    var repository = new FileRepository(workingDir);
    var bundleWriter = new BundleWriter(repository);
    Ref head = repository.GetRef("HEAD");
    bundleWriter.Include(head);
 }
}

throws an exception:

Unhandled Exception: System.ArgumentException: Invalid ref name: HEAD
  at NGit.Transport.BundleWriter.Include (System.String name, NGit.AnyObjectId id) [0x00000] in <filename unknown>:0 
  at NGit.Transport.BundleWriter.Include (Ref r) [0x00000] in <filename unknown>:0 
  at M.Main () [0x00000] in <filename unknown>:0 

NullReferenceException in DiffieHellmanManaged.Dispose brings down process

Sometimes, communication with the server fails. When this happens, a NullReferenceException in DiffieHellmanManaged.Dispose on the finalizer thread brings down the process.

The NullReferenceException in itself is not a problem. However, that it happens on the finalizer thread is. It looks like adding a using in Sharpen.DHKeyPairGenerator should solve this issue.

How to respond to git clone, push and pull commands

Using NGit (or even JGit since it's a port) does anyone know how to respond to the Git clone command over Smart HTTP? What would the sample code look like?

I can't find any references or documentation which describes this.

I'm trying to create a .NET GIT server to handle simple clone, push and pull requests.

Any help is appreciated.

Sharpen ScheduledThreadPoolExecutor unit tests fail

In response to

http://stackoverflow.com/questions/6310691/some-ngit-stuff-prevents-c-application-from-shutting-down-correctly

I thought I'd have a look. I used 4d686e9 and built with monodevelop 2.6 beta2 (mono 2.11 master/722f989)

ThreeTwo of the ScheduledThreadPoolExecutor unit tests intermittently fail:
MonoDevelop NUnit screenshots

The places where it asserts are:

  1. at Sharpen.Test.ScheduledThreadPoolExecutorTests.InsertDelayedTask () [0x000c1] in /tmp/ngit/Sharpen.Test/ScheduledThreadPoolExecutorTests.cs:50
  2. at Sharpen.Test.ScheduledThreadPoolExecutorTests.Shutdown () [0x00077] in /tmp/ngit/Sharpen.Test/ScheduledThreadPoolExecutorTests.cs:98

I'm not too sure whether it's just racey test cases, or that there is a fundamental problem. However, since the asker on Stack Overflow was experiencing shutdown problems with threads waiting around forever, I thought I'd report this just in case.

Cheers,
Seth

[NGit] TransportHttp.IsSmartHttp bug when charset is specified in header

The NGit.Transport.HttpTransport.IsSmartHttp method performs a direct equality comparison between an expected content-type header value and the actual one.

However, some HTTP servers append a charset value at the end of the content-type header, which confuses the equality check.
For instance, "application/x-git-upload-pack-advertisement; charset=utf-8" is still valid Smart-HTTP, but because it does not equal "application/x-git-upload-pack-advertisement", IsSmartHttp returns false.

This is reproducible for the AppHarbor.com service and repositories hosted by Git Web (http://gitweb.codeplex.com).

Diff is duplicated

  1. Clone GIT to local directory
  2. Delete file test.txt
  3. Add file test.txt
  4. Run Diff command

Unexpected result: Diff command return 4 entries
image

Expected result: Diff command return empty list

Port to NetStandard 2.0

In order to more easily port ngit to .net-core, could we

  1. In NGit\NGit.Util.IO\ThrowingPrintWriter.cs
    Add
    public override Encoding Encoding => System.Text.Encoding.UTF8;

within #IF NETFX ?

so it compiles with NETSTANDARD 2.0

As well as making the following changes

A) In Mono.Posix move Remoting to a separate dll ?
Mono.Remoting.Channels.Unix

Mono.unix -- deleted remoting

B) Mono.Posix/Mono.Unix.Native/CdeclFunction.cs
In CdeclFunction, dispose of


	//this.assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (
			//		assemblyName, AssemblyBuilderAccess.Run);

				///* MethodBuilder mb = */ tb.DefinePInvokeMethod (
				//		method, 
				//		library, 
				//		MethodAttributes.PinvokeImpl | MethodAttributes.Static | MethodAttributes.Public,
				//		CallingConventions.Standard, 
				//		returnType, 
				//		parameterTypes, 
				//		CallingConvention.Cdecl,
				//		CharSet.Ansi);
				//mi = tb.CreateType ().GetMethod (method);

In
\NSch\Mono.Security\Mono.Security.Protocol.Tls
remove the DebugHelper
DebugHelper.cs -- removed debug.Lisneter.add

And in
NSch\Mono.Security\Mono.Security.Protocol.Tls\HttpsClientStream.cs

somehow replace this code, or make it conditional to full .net framework.

#pragma warning disable 618
//if (ServicePointManager.CertificatePolicy != null) {
// ServicePoint sp = _request.ServicePoint;
// bool res = ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, _request, _status);
// if (!res)
// return false;
// failed = true;
//}

Added issues for Mono.Posix and Mono.Security
Maybe fork out Mono.Security until the NETSTANDARD port of Mono.Security is ready.
Also, fork out Mono.Posix from mono, as there is no nuget-library.

In case anybody needs ngit for NETSTANDARD 2.0:
https://github.com/ststeiger/ngit-core

Make Sharpen.Runtime public

My application needs to call setProperty() to override "jgit.gitprefix" before using NGit. But current Sharpen.Runtime class is declared as internal which only visible to NGit.

Exception / hang on Mono.Security Diffie-Helman key generation for SSH Transport

Hey guys, sorry for the very boring title..

I'm trying to do pushes through SSH. I am specifying my own keys by using the method set out here: http://stackoverflow.com/questions/13764435/ngit-making-a-connection-with-a-private-key-file

It works well with a clone, and on the first push. After that, it fails 30% of the time, always in this method in Mono.Security:

Mono.Security.dll!Mono.Math.BigInteger.Kernel.MinusEq(Mono.Math.BigInteger big, Mono.Math.BigInteger small)

Either it fails with the message: "Error occurred during a cryptographic function", or it hangs indefinitely in this function. Again, it seems completely random whether it succeeds or not. It is being called by function in NGit:

DiffieHellmanManaged dh = new DiffieHellmanManaged (pspec.P.GetBytes (), pspec.G.GetBytes (), 0);

in GenerateKeyPair (KeyPairGenerator.cs)

Any ideas? If not, are there any ways to generate the Diffie-Helman keys through some other method?

Thanks so much -- NGit is awesome!

Cheers,
Leo

<p> in XML documentation comments causes error in IntelliSense

Currently when the documentation is generated for the translated C# code, <p> tags from the javadoc comments are copied as-is to the output. These tags cause Visual Studio's IntelliSense to report an error rather than show useful information in the code completion and hover tips. There are a few possible ways to address this:

  1. By converting these tags to <p/> for the XML comments.
  2. By omitting the tag altogether in the output.
  3. By converting the tag to <br/> or some other tag in the output.

Crash when home folder can't be located

When trying to open repository on IIS NGit.Util.FS_Win32.UserHome fails to find home folder and returns null, which causes null reference exception in NGit.Util.SystemReader.UpenUserConfig. I'm not sure if ngit can live without user config internally, but it would be nice to have the possibility to at least redirect home folder somewhere else programatically.

[NullReferenceException: Object reference not set to an instance of an object.]
   Sharpen.FilePath..ctor(FilePath other, String child) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\Sharpen\Sharpen\FilePath.cs:25
   NGit.Util._SystemReader_65.OpenUserConfig(Config parent, FS fs) in E:\Projects\slluis-ngit-54a43da\NGit\NGit.Util\SystemReader.cs:116
   NGit.Storage.File.FileRepository..ctor(BaseRepositoryBuilder options) in E:\Projects\slluis-ngit-54a43da\NGit\NGit.Storage.File\FileRepository.cs:141
   NGit.BaseRepositoryBuilder`2.Build() in E:\Projects\slluis-ngit-54a43da\NGit\NGit\BaseRepositoryBuilder.cs:700
   NGit.Api.Git.Open(FilePath dir, FS fs) in E:\Projects\slluis-ngit-54a43da\NGit\NGit.Api\Git.cs:129
   NGit.Api.Git.Open(FilePath dir) in E:\Projects\slluis-ngit-54a43da\NGit\NGit.Api\Git.cs:109

CopyOnWriteArrayList is dangerously broken

I was looking for CopyOnWriteArrayList implementation for C# and have ended up here. Please correct your implementation - it is very dangerous if people try to use it for real things. You CANNOT lock on the object you are going to replace in same method. Create some dedicated lock object and synchronize on that. Otherwise, multiple threads can synchronize on different instances of list, losing some updates.

Additionally IndexOf is broken - you need to put reference to list into local variable at very start and use it, rather than iterating through possibly mutating 'this'.
Same for Iterator() - list reference can change between filling both arguments.

build in monodevelop doesn't work

If I build with xbuild everything works fine.
However if I use MonoDevelop it shows errors like:
error CS1061: Type System.Collections.ArrayList' does not contain a definition forRemoveElement' and no extension method RemoveElement' of typeSystem.Collections.ArrayList' could be found (are you missing a using directive or an assembly reference?)

Ngit CredentialProvider - Keypair

How do you use Ngit with a public/private ssh keypair?

I can't seem to find documentation anywhere, and the framework's not throwing me any hints.

Ngit File locks

While trying to write some NGit related tests I always get UnauthorizedAccessExceptions when trying to delete my repo path after creating it.

is there a way to release any pack file locks?

running

repo.GetRepository().Close();

doesn't seem to fix things.

Code is outdated

last commit here is several years old
git://git.eclipse.org/gitroot/jgit/jgit.git
have newer versions like
JGit v4.0.0.201506090130-r
Contained in tags: v4.0.0.201506090130-r
Commit hash: 4f221854556991e3394b3a71e77ee0b771b1500b
Date: 2 weeks ago (09.06.2015 8:29:27)

see also
gitextensions/gitextensions#2516

earlier attempt:
https://github.com/henon/GitSharp

slluis:
"The really hard parts are:

  1. Java constructs that make sharpen crash. When sharpen crashes is not always easy to find out what caused the crash.
  2. Java constructs not supported by sharpen.
  3. Incorrectly generated C# code. It has to be manually patched.
  4. Missing implementations of core java methods. Those have to be implemented or mapped to existing .NET methods using the configuration file.

Some of those problems could be alleviated by improving Sharpen, but only to some extent, since there are some Java constructs which are not easily translatable to C# (and JGit uses many of them)."

https://github.com/pvginkel/gitter/issues/15

NGit does not provide a Stage function which would make deleted files be marked as staged deletes.
mono/monodevelop#653

GPL/LGPL questions with Sharpen.Unix
mono/sharpen#39

weak documentation
#13

I think it should be possible to run JGit on mono directly with ikvm, but can't find posts about it.
UPD:
https://github.com/mono/jgit-binary
http://tirania.org/blog/archive/2009/Oct-12.html

Outdated ciphers for using JSch

It would appear that the ciphers provided in the current version are not being kept up to date.

The current ciphers align with JSCH-0.1.46 and these are no longer supported by many major providers (eg Bitbucket).

We need to update the Jsch ciphers in this library to support the newer KEXs

Cached RmCommand unavailable

Hello,

I noticed RmCommand doesn't contain the cached option in NGit. I researched if its implemented in JGit(so i send a patch if its not), but it was implemented. Maybe only regenerating the NGit code is needed or?

IsClean()

I am trying to use IsClean() to determine if the remote repository has changed or not but when I try to use IsClean() it always return true when I change the remote repo (when I change file in local repo it returns false, that means it works for this case). Is there any problem with this particular function or am I missing something.

       var repository = Git.Open(C:\git);

        while (repository.Status().Call().IsClean())
        {
            repository.Pull().Call(); // this function change the repo status
            Console.WriteLine("Is clean");
        }

Clone, Fetch, Push documentation / examples

This project really needs a wiki with examples how to get basic remote operations to work, and perhaps some very basic examples.

Have been searching and trying to get NGit to work with Clone, Fetch and Push using ssh with a private key file, for the last 3 days without luck. Is here any places where such examples exists? - have looked through many of the tests without any luck as well.

Working under Windows

Just wanted to check if this has been tested under Windows. I'm running the unit tests in NGIT.Tests but I have a number of fails all in TearDown methods where it is failing to delete a file.
TearDown : NUnit.Framework.AssertionException : ERROR: Failed to delete target\trash\test1302238002145_390 in NGit.Merge.SimpleMergeTest.391
--TearDown
at NUnit.Framework.Assert.Fail(String message, Object[] args)
at NGit.Junit.LocalDiskRepositoryTestCase.ReportDeleteFailure(String testName, Boolean failOnError, FilePath e)
at NGit.Junit.LocalDiskRepositoryTestCase.RecursiveDelete(String testName, FilePath dir, Boolean silent, Boolean failOnError)
at NGit.Junit.LocalDiskRepositoryTestCase.RecursiveDelete(String testName, FilePath dir, Boolean silent, Boolean failOnError)
at NGit.Junit.LocalDiskRepositoryTestCase.TearDown()

Cannot do a clean compile on Win7 64-bit due to missing reference

I'm trying to compile the latest HEAD of the NGit repository (4ff676b) and this fails because of a missing Mono.Posix reference in the Sharpen project.

The instructions say:

"
If you are compiling on Windows using the Microsoft .NET
framework you can obtain these libraries (ICSharpCode.SharpZipLib and Mono.Security) .by installing the Mono Libraries
package: http://monodevelop.com/files/Windows/MonoLibraries.msi
"

However, there is no mention of Mono.Posix and that setup does not install any Mono.Posix library. This is the list of libraries I have in C:\Program Files (x86)\MonoLibraries\2.6:

ICSharpCode.SharpZipLib.dll
mautil.exe
Mono.Addins.CecilReflector.dll
Mono.Addins.dll
Mono.Addins.Gui.dll
Mono.Addins.Setup.dll
Mono.GetOptions.dll
Mono.Security.dll
monodoc.dll

Where can I get the correct library to add as a reference? And should the documentation change to reflect this issue?

(I'm trying to verify if #Num: #9 is actually closed by using a new version of NGit - hence the need for a compile)

how to use ngit api, to get remote repository?

i am new with ngit..
i use the code blow:
CloneCommand clone = Git.CloneRepository();
clone.SetURI("git://github.com/jquery/jquery.git").
SetDirectory(@"D:\localRepository").
Call();
it throw an exception...
so ,i want to know, how to clone a remote repository with ngit api..

thanks..

Build issues with VS2010 SP1

Sharpen.Extensions.GetTotalInFixed() won't compile due to Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?) Extensions.cs 629, which is easily fixed by changing the function body to

if( inf.TotalIn > 0 )
  return Convert.ToInt32( inf.TotalIn ) + 4;
return 0;

Furrthermore I get 286 warnings, of which most seem to be very easy to fix.

Cloning works on IISExpress but fails on normal IIS.

Hi,

I dont know if this is a bug or just something that I am missing to configure.
When I run my MVC 4 application on IISExpress it works like a charm and clones my git repository. As soon as I switch to use regular IIS I get a "Object reference not set to an instance of an object."

Here is the stacktrace:
at Sharpen.FilePath..ctor(FilePath other, String child) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\Sharpen\Sharpen\FilePath.cs:line 25
at NGit.Util.SystemReader._SystemReader_65.OpenUserConfig(Config parent, FS fs) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Util\SystemReader.cs:line 116
at NGit.Storage.File.FileRepository..ctor(BaseRepositoryBuilder options) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Storage.File\FileRepository.cs:line 141
at NGit.BaseRepositoryBuilder2.Build() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit\BaseRepositoryBuilder.cs:line 700 at NGit.Api.InitCommand.Call() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\InitCommand.cs:line 108 at NGit.Api.CloneCommand.Init(URIish u) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\CloneCommand.cs:line 131 at NGit.Api.CloneCommand.Call() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\CloneCommand.cs:line 100 at SourceDeploy.Services.GitSourceControlManagement.Clone(String path) in d:\Projects\ToolWise\Research\SourceDeploy\SourceDeploy.Services\GitSourceControlManagement.cs:line 17 at SourceDeploy.Controllers.HomeController.Index() in d:\Projects\ToolWise\Research\SourceDeploy\SourceDeploy\Controllers\HomeController.cs:line 19 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

A secure connection could not be established

ngit2, clone command, win10, .net4.5 vs2017 pro

WebException: The request was aborted: Could not create SSL/TLS secure channel

at Sharpen.HttpURLConnection.get_Response()
at Sharpen.HttpURLConnection.GetResponseCode()
at NGit.Util.HttpSupport.Response(HttpURLConnection c)
at NGit.Transport.TransportHttp.Connect(String service)
at NGit.Transport.TransportHttp.OpenFetch()
at NGit.Transport.FetchProcess.ExecuteImp(ProgressMonitor monitor, FetchResult result)
at NGit.Transport.FetchProcess.Execute(ProgressMonitor monitor, FetchResult result)
at NGit.Transport.Transport.Fetch(ProgressMonitor monitor, ICollection`1 toFetch)
at NGit.Api.FetchCommand.Call()
at NGit.Api.CloneCommand.Fetch(Repository clonedRepo, URIish u)
at NGit.Api.CloneCommand.Call()
at WebApplication1.WebForm1.kk() in C:\Users\myu\source\repos\WebApplication1\WebApplication1\WebForm1.aspx.cs:line 25
at WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Users\myu\source\repos\WebApplication1\WebApplication1\WebForm1.aspx.cs:line 16
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Object reference not set to an instance of an object.

hi
i got a exception when call clone command, can you help it?
StackTrace:
at Sharpen.HttpURLConnection.GetResponseCode() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\Sharpen\Sharpen\HttpURLConnection.cs:line 177
at NGit.Util.HttpSupport.Response(HttpURLConnection c) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Util\HttpSupport.cs:line 264
at NGit.Transport.TransportHttp.Connect(String service) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Transport\TransportHttp.cs:line 509
at NGit.Transport.TransportHttp.OpenFetch() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Transport\TransportHttp.cs:line 291
at NGit.Transport.FetchProcess.ExecuteImp(ProgressMonitor monitor, FetchResult result) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Transport\FetchProcess.cs:line 126
at NGit.Transport.FetchProcess.Execute(ProgressMonitor monitor, FetchResult result) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Transport\FetchProcess.cs:line 104
at NGit.Transport.Transport.Fetch(ProgressMonitor monitor, ICollection`1 toFetch) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Transport\Transport.cs:line 1226
at NGit.Api.FetchCommand.Call() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\FetchCommand.cs:line 139
at NGit.Api.CloneCommand.Fetch(Repository repo, URIish u) in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\CloneCommand.cs:line 163
at NGit.Api.CloneCommand.Call() in C:\Users\Administrator\Desktop\ngit-xpaulbettsx\NGit\NGit.Api\CloneCommand.cs:line 101
at ConsoleApp1.Class2.kk() in C:\Users\myu\source\repos\ConsoleApp1\ConsoleApp1\Class2.cs:line 13
at ConsoleApp1.Program.Main(String[] args) in C:\Users\myu\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 54
My code is easy:
var clone = NGit.Api.Git.CloneRepository();
clone.SetDirectory(new Sharpen.FilePath(@"d:\abcde"));
clone.SetURI("https://github.com/xxxx/xxxx.git");
//clone.SetCredentialsProvider(new UsernamePasswordCredentialsProvider("xxxx", "xxxx"));
clone.Call(); ------ throw exception
my system is window 10 Pro N, visual studio 2017 pro, .net 4.5 ngit1.0
thank you

[NSch] Unable to get Ssh connection with private/public key working

This is the code I'm currently using:

JSch jsch = new JSch();
jsch.AddIdentity("/path/to/mykey");

Session session = jsch.GetSession("someuser", "somehost");
Hashtable table = new Hashtable();
table["StrictHostKeyChecking"] = "no";
table["PasswordAuthentication"] = "no";
table["ChallengeResponseAuthentication"] = "no";
table["X11Forwarding"] = "no";
table["BatchMode"] = "no";
session.SetConfig(table);
session.Connect();
session.Disconnect();

On the server side I get this:

Oct 31 22:30:21 somehost sshd[12841]: error: RSA_public_decrypt failed:    error:0407006A:lib(4):func(112):reason(106)

This is using an RSA key, I tried using DSA as well and it doesn't work either. Using ssh -i /path/to/key somehost works fine.

NGit.Api.ApplyCommandTest tests failing on Windows

I have another set of tests failing on Windows.

NGit.Api.ApplyCommandTest.TestAddA1:
NGit.Errors.InvalidObjectIdException : Invalid id : de98044

NGit.Api.ApplyCommandTest.TestAddA2:
NGit.Errors.InvalidObjectIdException : Invalid id : de98044

NGit.Api.ApplyCommandTest.TestDeleteD:
NGit.Errors.InvalidObjectIdException : Invalid id : 0000000

Those are throwing an IndexOutOfRangeException in RawParseUtils.ParseHextInt32, which FromHexString catches and rethrows as an InvalidObjectIdException

Then, the remaining tests in NGit.Api.ApplyCommandTest are failing with a different error:

NGit.Api.ApplyCommandTest.TestModifyE:
System.ArgumentException : Illegal characters in path.

NGit.Api.ApplyCommandTest.TestModifyX:
System.ArgumentException : Illegal characters in path.

NGit.Api.ApplyCommandTest.TestModifyY:
System.ArgumentException : Illegal characters in path.

NGit.Api.ApplyCommandTest.TestModifyY:
System.ArgumentException : Illegal characters in path.

These are getting kicked out of the FilePath constructor from this line: this.path = Path.Combine (other, child);

For TestModityE, for example, other == "C:\Users\dprothero\Documents\GitHub\ngit\bin\target\trash\test1341691177321_542" and child == "E\r"

I'm assuming it doesn't like the backslash?

I'm still way too new to the codebase to be able to see what is going on with these issues.

[Sharpen] HttpURLConnection.Response results in WebException when StatusCode=401

The .NET Framework HttpWebRequest.GetResponse() throws a WebException when the response's status code is HTTP 401. The actual response is contained in the Exception.

However, the getter of the Response property of HttpURLConnection does not try to catch this type of exception, which results in an unhandled WebException when HTTP authorization fails, instead of the expected JGitInternalException.

Missing NGit/NGit.Blame directory after merge from JGit

Simple issue, probably forgot to add the new directory? It is referenced in the project file since this revision:

$git log --all -SNGit.Blame --oneline  --decorate
abff6b6 (origin/master, origin/HEAD, master) Updated from JGit ---------------------------------------------------- JGit commit         f1713abcdcb5097d4e448

Nsch - generating RSA key fails with casting exception

if you do:

var keyPair = NSch.KeyPair.GenKeyPair(jsch, NSch.KeyPair.RSA, 1024);

you get a casting exception:

Unable to cast object of type 'Sharpen.RSAPrivateKey' to type 'Sharpen.RSAPrivateCrtKey'.

I'm going to try and clone and fix the bug, but I'm just wanting to check i'm calling it correctly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.