lib git: Add detection of git-bin repos

This commit is contained in:
Hylke Bons 2012-06-29 16:44:02 +01:00
parent efccc2c1c3
commit 9dc0b6af5b
2 changed files with 21 additions and 20 deletions

View file

@ -30,13 +30,13 @@ namespace SparkleLib.Git {
public class SparkleFetcher : SparkleFetcherBase {
private SparkleGit git;
private bool use_git_bin;
private string crypto_salt = "e0d592768d7cf99a"; // TODO: Make unique per repo
private bool use_git_bin = false; // TODO
public SparkleFetcher (string server, string required_fingerprint, string remote_path,
string target_folder, bool fetch_prior_history) : base (server, required_fingerprint, remote_path,
target_folder, fetch_prior_history)
string target_folder, bool fetch_prior_history) : base (server, required_fingerprint,
remote_path, target_folder, fetch_prior_history)
{
Uri uri = RemoteUrl;
@ -61,6 +61,9 @@ namespace SparkleLib.Git {
} else if (uri.Host.Equals ("github.com")) {
uri = new Uri ("ssh://git@github.com" + uri.AbsolutePath);
} else if (uri.Host.Equals ("bitbucket.org")) {
// Nothing really
} else if (uri.Host.Equals ("gnome.org")) {
uri = new Uri ("ssh://git@gnome.org/git" + uri.AbsolutePath);
@ -74,6 +77,8 @@ namespace SparkleLib.Git {
else
uri = new Uri (uri.Scheme + "://git@" + uri.Host + ":" + uri.Port + uri.AbsolutePath);
}
this.use_git_bin = true;
}
TargetFolder = target_folder;
@ -305,7 +310,7 @@ namespace SparkleLib.Git {
"core.packedGitWindowSize 128m",
"pack.deltaCacheSize 128m",
"pack.packSizeLimit 128m",
"pack.windowMemory 128m",
"pack.windowMemory 128m"
};
foreach (string setting in settings) {

View file

@ -26,14 +26,16 @@ namespace SparkleLib.Git {
public class SparkleRepo : SparkleRepoBase {
private bool author_set;
private bool use_mass_storage;
private bool use_git_bin;
public SparkleRepo (string path) : base (path)
{
//this.use_mass_storage =
//SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (Name, "use_mass_storage")
// .Equals (bool.TrueString);
SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean");
git.Start ();
git.WaitForExit ();
this.use_git_bin = (git.ExitCode == 0);
}
@ -157,7 +159,7 @@ namespace SparkleLib.Git {
SparkleHelpers.DebugInfo ("Git", Name + " | Checking for remote changes...");
string current_revision = CurrentRevision;
SparkleGit git = new SparkleGit (LocalPath, "ls-remote --exit-code \"" + RemoteUrl + "\" master");
SparkleGit git = new SparkleGit (LocalPath, "ls-remote --heads --exit-code \"" + RemoteUrl + "\" master");
git.Start ();
git.WaitForExit ();
@ -193,16 +195,13 @@ namespace SparkleLib.Git {
Commit (message);
}
// TODO: set remote_url from config
if (this.use_mass_storage) {
/* SparkleGit git_bin = new SparkleGitBin (LocalPath, "push");
if (this.use_git_bin) {
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push");
git_bin.Start ();
git_bin.WaitForExit ();
*/ // TODO: Progress
}
// TODO: Progress
}
SparkleGit git = new SparkleGit (LocalPath,
"push --progress " + // Redirects progress stats to standarderror
@ -264,10 +263,7 @@ namespace SparkleLib.Git {
UpdateSizes ();
ChangeSets = GetChangeSets ();
if (git.ExitCode == 0)
return true;
else
return false;
return (git.ExitCode == 0);
}