在找到的代码PresentationCore.dll
(.NET4 WPF)由ILSpy:
// MS.Internal.PresentationCore.BindUriHelper
internal static string UriToString(Uri uri)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
return new StringBuilder(uri.GetComponents(uri.IsAbsoluteUri ? UriComponents.AbsoluteUri : UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), 2083).ToString();
}
Run Code Online (Sandbox Code Playgroud)
返回类型uri.GetComponents
是string
,为什么没有方法只返回string
值而不是将它包装在一个StringBuilder(string).ToString();
是这个设计?在一般意义上这样做的原因是什么?它会减少分配或改善垃圾收集还是用于线程安全?
我正在尝试git svn clone
从Codeplex的SSH.NET存储库.我的命令是:
git svn clone https://sshnet.svn.codeplex.com/svn/
Run Code Online (Sandbox Code Playgroud)
但它始终会以错误消息停止.这是我第一次遇到错误git svn clone
,我不知道这个SVN存储库是如何特殊的.
我试图谷歌寻求答案,但我找到的任何东西都不适合我.我读过了:
这是错误消息:
r9445 = e8eb2162b4e5cc6b5b5129f0739c4f60cc42a58a (refs/remotes/git-svn)
M Renci.SshClient/Renci.SshNet/Sftp/SftpFileStream.cs
M Renci.SshClient/Renci.SshNet/Sftp/SftpFile.cs
M Renci.SshClient/Renci.SshNet/SshCommand.cs
M Renci.SshClient/Renci.SshNet/Shell.cs
M Renci.SshClient/Renci.SshNet/SftpClient.cs
M Renci.SshClient/Renci.SshNet/PrivateKeyFile.cs
M Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
r9486 = 91aea22d35ad41f70fa583d262438cf00a0a117d (refs/remotes/git-svn)
M Renci.SshClient/Renci.SshNet/Security/Cryptography/Ciphers/RsaCi
pher.cs
A Renci.SshClient/Renci.SshNet/Security/Cryptography/RsaKey.cs
Renci.SshClient/Renci.SshNet/Security/Cryptography/RsaDigitalSignature.cs was no
t found in commit 91aea22d35ad41f70fa583d262438cf00a0a117d (r9486)
Run Code Online (Sandbox Code Playgroud) 使用libgit2sharp
,如何计算ahead
或behind
指标.喜欢这个页面https://github.com/libgit2/libgit2sharp/branches
例如,该行的.gitattributes
文件.代码的输出lg2s
*.cs diff=csharp
using (var repo = new Repository(@"path\to\lg2s"))
{
var tree1 = repo.Lookup<Commit>("a845db9").Tree;
var tree2 = repo.Lookup<Commit>("d677741").Tree;
var patches = repo.Diff.Compare<Patch>(tree1, tree2);
foreach (var patch in patches)
{
Console.WriteLine(patch.Patch);
}
}
Run Code Online (Sandbox Code Playgroud)
是(不久)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ namespace LibGit2Sharp
Run Code Online (Sandbox Code Playgroud)
但输出git bash
是(很快)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ internal RepositoryStatus(Repository repo, StatusOptions optio
Run Code Online (Sandbox Code Playgroud)
第二行不一样.
看起来有一个深入的讨论Add .gitattributes support
libgit2 /#508,但PR Add APIs for git attributes
libgit2 /#516是否合并?
现在支持多少种语言? …