Remove GitBin options
This commit is contained in:
parent
1ee979413f
commit
9fdb07af1a
|
@ -28,7 +28,6 @@ namespace SparkleLib.Git {
|
||||||
public class SparkleFetcher : SparkleFetcherSSH {
|
public class SparkleFetcher : SparkleFetcherSSH {
|
||||||
|
|
||||||
private SparkleGit git;
|
private SparkleGit git;
|
||||||
private bool use_git_bin;
|
|
||||||
private string cached_salt;
|
private string cached_salt;
|
||||||
|
|
||||||
private Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
private Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||||
|
@ -101,8 +100,6 @@ namespace SparkleLib.Git {
|
||||||
else
|
else
|
||||||
uri = new Uri (uri.Scheme + "://storage@" + uri.Host + ":" + uri.Port + uri.AbsolutePath);
|
uri = new Uri (uri.Scheme + "://storage@" + uri.Host + ":" + uri.Port + uri.AbsolutePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.use_git_bin = false; // TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteUrl = uri;
|
RemoteUrl = uri;
|
||||||
|
@ -381,24 +378,6 @@ namespace SparkleLib.Git {
|
||||||
SparkleGit git_config = new SparkleGit (TargetFolder, "config " + setting);
|
SparkleGit git_config = new SparkleGit (TargetFolder, "config " + setting);
|
||||||
git_config.StartAndWaitForExit ();
|
git_config.StartAndWaitForExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.use_git_bin)
|
|
||||||
InstallGitBinConfiguration ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void InstallGitBinConfiguration ()
|
|
||||||
{
|
|
||||||
string [] settings = new string [] {
|
|
||||||
"core.bigFileThreshold 1024g",
|
|
||||||
"filter.bin.clean \"git bin clean %f\"",
|
|
||||||
"filter.bin.smudge \"git bin smudge\""
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string setting in settings) {
|
|
||||||
SparkleGit git_config = new SparkleGit (TargetFolder, "config " + setting);
|
|
||||||
git_config.StartAndWaitForExit ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,28 +401,22 @@ namespace SparkleLib.Git {
|
||||||
string attribute_rules_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
|
string attribute_rules_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
|
||||||
TextWriter writer = new StreamWriter (attribute_rules_file_path);
|
TextWriter writer = new StreamWriter (attribute_rules_file_path);
|
||||||
|
|
||||||
if (this.use_git_bin) {
|
// Compile a list of files we don't want Git to compress.
|
||||||
writer.WriteLine ("* filter=bin binary");
|
// Not compressing already compressed files decreases memory usage and increases speed
|
||||||
|
string [] extensions = new string [] {
|
||||||
|
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
||||||
|
"flac", "mp3", "ogg", "oga", // Audio
|
||||||
|
"avi", "mov", "mpg", "mpeg", "mkv", "ogv", "ogx", "webm", // Video
|
||||||
|
"zip", "gz", "bz", "bz2", "rpm", "deb", "tgz", "rar", "ace", "7z", "pak", "tc", "iso", ".dmg" // Archives
|
||||||
|
};
|
||||||
|
|
||||||
} else {
|
foreach (string extension in extensions) {
|
||||||
// Compile a list of files we don't want Git to compress.
|
writer.WriteLine ("*." + extension + " -delta");
|
||||||
// Not compressing already compressed files decreases memory usage and increases speed
|
writer.WriteLine ("*." + extension.ToUpper () + " -delta");
|
||||||
string [] extensions = new string [] {
|
|
||||||
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
|
||||||
"flac", "mp3", "ogg", "oga", // Audio
|
|
||||||
"avi", "mov", "mpg", "mpeg", "mkv", "ogv", "ogx", "webm", // Video
|
|
||||||
"zip", "gz", "bz", "bz2", "rpm", "deb", "tgz", "rar", "ace", "7z", "pak", "tc", "iso", ".dmg" // Archives
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string extension in extensions) {
|
|
||||||
writer.WriteLine ("*." + extension + " -delta");
|
|
||||||
writer.WriteLine ("*." + extension.ToUpper () + " -delta");
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.WriteLine ("*.txt text");
|
|
||||||
writer.WriteLine ("*.TXT text");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writer.WriteLine ("*.txt text");
|
||||||
|
writer.WriteLine ("*.TXT text");
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,25 +61,4 @@ namespace SparkleLib.Git {
|
||||||
StartInfo.Arguments = "--exec-path=\"" + ExecPath + "\" " + args;
|
StartInfo.Arguments = "--exec-path=\"" + ExecPath + "\" " + args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SparkleGitBin : SparkleProcess {
|
|
||||||
|
|
||||||
public static string GitBinPath;
|
|
||||||
|
|
||||||
|
|
||||||
public SparkleGitBin (string path, string args) : base (path, args)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty (GitBinPath))
|
|
||||||
GitBinPath = LocateCommand ("git-bin");
|
|
||||||
|
|
||||||
EnableRaisingEvents = true;
|
|
||||||
StartInfo.FileName = GitBinPath;
|
|
||||||
StartInfo.RedirectStandardOutput = true;
|
|
||||||
StartInfo.UseShellExecute = false;
|
|
||||||
StartInfo.WorkingDirectory = path;
|
|
||||||
StartInfo.CreateNoWindow = true;
|
|
||||||
StartInfo.Arguments = args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace SparkleLib.Git {
|
||||||
public class SparkleRepo : SparkleRepoBase {
|
public class SparkleRepo : SparkleRepoBase {
|
||||||
|
|
||||||
private bool user_is_set;
|
private bool user_is_set;
|
||||||
private bool use_git_bin;
|
|
||||||
private bool is_encrypted;
|
private bool is_encrypted;
|
||||||
|
|
||||||
private string cached_branch;
|
private string cached_branch;
|
||||||
|
@ -91,15 +90,6 @@ namespace SparkleLib.Git {
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false");
|
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false");
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
// Check if we should use git-bin
|
|
||||||
git = new SparkleGit (LocalPath, "config --get filter.bin.clean");
|
|
||||||
git.StartAndWaitForExit ();
|
|
||||||
|
|
||||||
this.use_git_bin = (git.ExitCode == 0);
|
|
||||||
|
|
||||||
if (this.use_git_bin)
|
|
||||||
ConfigureGitBin ();
|
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\"");
|
git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\"");
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
|
@ -110,22 +100,6 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ConfigureGitBin ()
|
|
||||||
{
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "config filter.bin.clean \"git bin clean %f\"");
|
|
||||||
git.StartAndWaitForExit ();
|
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "config filter.bin.smudge \"git bin smudge\"");
|
|
||||||
git.StartAndWaitForExit ();
|
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "config git-bin.sftpUrl \"" + RemoteUrl + "\"");
|
|
||||||
git.StartAndWaitForExit ();
|
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "config git-bin.sftpPrivateKeyFile \"" + base.local_config.User.PrivateKeyFilePath + "\"");
|
|
||||||
git.StartAndWaitForExit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override List<string> ExcludePaths {
|
public override List<string> ExcludePaths {
|
||||||
get {
|
get {
|
||||||
List<string> rules = new List<string> ();
|
List<string> rules = new List<string> ();
|
||||||
|
@ -243,13 +217,6 @@ namespace SparkleLib.Git {
|
||||||
if (message != null)
|
if (message != null)
|
||||||
Commit (message);
|
Commit (message);
|
||||||
|
|
||||||
if (this.use_git_bin) {
|
|
||||||
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push");
|
|
||||||
git_bin.StartAndWaitForExit ();
|
|
||||||
|
|
||||||
// TODO: Progress
|
|
||||||
}
|
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "push --progress \"" + RemoteUrl + "\" " + this.branch);
|
SparkleGit git = new SparkleGit (LocalPath, "push --progress \"" + RemoteUrl + "\" " + this.branch);
|
||||||
git.StartInfo.RedirectStandardError = true;
|
git.StartInfo.RedirectStandardError = true;
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
@ -312,8 +279,6 @@ namespace SparkleLib.Git {
|
||||||
UpdateSizes ();
|
UpdateSizes ();
|
||||||
|
|
||||||
if (git.ExitCode == 0) {
|
if (git.ExitCode == 0) {
|
||||||
ClearCache ();
|
|
||||||
|
|
||||||
string salt_file_path = new string [] { LocalPath, ".git", "salt" }.Combine ();
|
string salt_file_path = new string [] { LocalPath, ".git", "salt" }.Combine ();
|
||||||
|
|
||||||
// If the repo is encrypted, create a branch to
|
// If the repo is encrypted, create a branch to
|
||||||
|
@ -405,13 +370,10 @@ namespace SparkleLib.Git {
|
||||||
UpdateSizes ();
|
UpdateSizes ();
|
||||||
|
|
||||||
if (git.ExitCode == 0) {
|
if (git.ExitCode == 0) {
|
||||||
if (Merge ()) {
|
if (Merge ())
|
||||||
ClearCache ();
|
|
||||||
return true;
|
return true;
|
||||||
|
else
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Error = ErrorStatus.HostUnreachable;
|
Error = ErrorStatus.HostUnreachable;
|
||||||
|
@ -1034,16 +996,6 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ClearCache ()
|
|
||||||
{
|
|
||||||
if (!this.use_git_bin)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "clear -f");
|
|
||||||
git_bin.StartAndWaitForExit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Git doesn't track empty directories, so this method
|
// Git doesn't track empty directories, so this method
|
||||||
// fills them all with a hidden empty file.
|
// fills them all with a hidden empty file.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue