Remove GitBin options

This commit is contained in:
Hylke Bons 2016-03-26 10:40:52 +00:00
parent 1ee979413f
commit 9fdb07af1a
3 changed files with 15 additions and 111 deletions

View file

@ -28,7 +28,6 @@ namespace SparkleLib.Git {
public class SparkleFetcher : SparkleFetcherSSH {
private SparkleGit git;
private bool use_git_bin;
private string cached_salt;
private Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
@ -101,8 +100,6 @@ namespace SparkleLib.Git {
else
uri = new Uri (uri.Scheme + "://storage@" + uri.Host + ":" + uri.Port + uri.AbsolutePath);
}
this.use_git_bin = false; // TODO
}
RemoteUrl = uri;
@ -381,24 +378,6 @@ namespace SparkleLib.Git {
SparkleGit git_config = new SparkleGit (TargetFolder, "config " + setting);
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 ();
TextWriter writer = new StreamWriter (attribute_rules_file_path);
if (this.use_git_bin) {
writer.WriteLine ("* filter=bin binary");
// Compile a list of files we don't want Git to compress.
// 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 {
// Compile a list of files we don't want Git to compress.
// 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
};
foreach (string extension in extensions) {
writer.WriteLine ("*." + extension + " -delta");
writer.WriteLine ("*." + extension.ToUpper () + " -delta");
}
writer.WriteLine ("*.txt text");
writer.WriteLine ("*.TXT text");
foreach (string extension in extensions) {
writer.WriteLine ("*." + extension + " -delta");
writer.WriteLine ("*." + extension.ToUpper () + " -delta");
}
writer.WriteLine ("*.txt text");
writer.WriteLine ("*.TXT text");
writer.Close ();
}
}

View file

@ -61,25 +61,4 @@ namespace SparkleLib.Git {
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;
}
}
}

View file

@ -29,7 +29,6 @@ namespace SparkleLib.Git {
public class SparkleRepo : SparkleRepoBase {
private bool user_is_set;
private bool use_git_bin;
private bool is_encrypted;
private string cached_branch;
@ -91,15 +90,6 @@ namespace SparkleLib.Git {
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false");
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.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 {
get {
List<string> rules = new List<string> ();
@ -242,13 +216,6 @@ namespace SparkleLib.Git {
if (message != null)
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);
git.StartInfo.RedirectStandardError = true;
@ -312,8 +279,6 @@ namespace SparkleLib.Git {
UpdateSizes ();
if (git.ExitCode == 0) {
ClearCache ();
string salt_file_path = new string [] { LocalPath, ".git", "salt" }.Combine ();
// If the repo is encrypted, create a branch to
@ -405,13 +370,10 @@ namespace SparkleLib.Git {
UpdateSizes ();
if (git.ExitCode == 0) {
if (Merge ()) {
ClearCache ();
if (Merge ())
return true;
} else {
else
return false;
}
} else {
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
// fills them all with a hidden empty file.
//