2011-06-01 23:08:05 +00:00
|
|
|
|
// SparkleShare, a collaboration and sharing tool.
|
2011-05-16 20:19:58 +00:00
|
|
|
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
|
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Diagnostics;
|
2011-08-27 15:10:39 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
2012-02-18 22:16:25 +00:00
|
|
|
|
using System.Threading;
|
2012-03-14 03:26:42 +00:00
|
|
|
|
|
2012-02-28 13:34:15 +00:00
|
|
|
|
using SparkleLib;
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
2012-03-01 17:02:52 +00:00
|
|
|
|
namespace SparkleLib.Git {
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
|
|
|
|
// Sets up a fetcher that can get remote folders
|
2012-03-01 17:02:52 +00:00
|
|
|
|
public class SparkleFetcher : SparkleFetcherBase {
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
2011-08-26 20:47:46 +00:00
|
|
|
|
private SparkleGit git;
|
2012-04-22 12:32:55 +00:00
|
|
|
|
private string crypto_salt = "e0d592768d7cf99a"; // TODO: Make unique per repo
|
2011-08-26 20:47:46 +00:00
|
|
|
|
|
|
|
|
|
|
2012-04-12 22:44:31 +00:00
|
|
|
|
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)
|
2011-05-31 01:26:57 +00:00
|
|
|
|
{
|
2012-04-22 12:32:55 +00:00
|
|
|
|
Uri uri = RemoteUrl;
|
2011-05-31 01:26:57 +00:00
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
if (!uri.Scheme.Equals ("ssh") &&
|
|
|
|
|
!uri.Scheme.Equals ("git")) {
|
2012-04-11 21:10:02 +00:00
|
|
|
|
|
2012-03-08 23:27:49 +00:00
|
|
|
|
uri = new Uri ("ssh://" + uri);
|
2012-01-13 23:47:19 +00:00
|
|
|
|
}
|
2011-05-31 01:26:57 +00:00
|
|
|
|
|
2011-08-26 22:49:08 +00:00
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
if (uri.Host.Equals ("gitorious.org")) {
|
|
|
|
|
if (!uri.AbsolutePath.Equals ("/") &&
|
|
|
|
|
!uri.AbsolutePath.EndsWith (".git")) {
|
2011-08-26 22:49:08 +00:00
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath + ".git");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath);
|
2011-09-11 20:15:08 +00:00
|
|
|
|
}
|
2011-05-31 01:26:57 +00:00
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
} else if (uri.Host.Equals ("github.com")) {
|
|
|
|
|
uri = new Uri ("ssh://git@github.com" + uri.AbsolutePath);
|
|
|
|
|
|
|
|
|
|
} else if (uri.Host.Equals ("gnome.org")) {
|
|
|
|
|
uri = new Uri ("ssh://git@gnome.org/git" + uri.AbsolutePath);
|
2011-05-31 01:26:57 +00:00
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
} else {
|
2012-01-23 23:50:54 +00:00
|
|
|
|
if (string.IsNullOrEmpty (uri.UserInfo)) {
|
2012-03-08 23:27:49 +00:00
|
|
|
|
if (uri.Port == -1)
|
|
|
|
|
uri = new Uri (uri.Scheme + "://git@" + uri.Host + uri.AbsolutePath);
|
|
|
|
|
else
|
|
|
|
|
uri = new Uri (uri.Scheme + "://git@" + uri.Host + ":" + uri.Port + uri.AbsolutePath);
|
2012-01-23 23:50:54 +00:00
|
|
|
|
}
|
2011-05-31 01:26:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-13 23:47:19 +00:00
|
|
|
|
|
2012-02-09 01:46:25 +00:00
|
|
|
|
TargetFolder = target_folder;
|
2012-04-11 18:07:34 +00:00
|
|
|
|
RemoteUrl = uri;
|
2011-05-31 01:26:57 +00:00
|
|
|
|
}
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool Fetch ()
|
|
|
|
|
{
|
2012-04-12 22:44:31 +00:00
|
|
|
|
if (FetchPriorHistory) {
|
2012-03-29 00:44:26 +00:00
|
|
|
|
this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath,
|
|
|
|
|
"clone " +
|
|
|
|
|
"--progress " +
|
2012-04-22 12:32:55 +00:00
|
|
|
|
"--no-checkout " +
|
2012-03-29 00:44:26 +00:00
|
|
|
|
"--depth=1 " +
|
|
|
|
|
"\"" + RemoteUrl + "\" \"" + TargetFolder + "\"");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath,
|
|
|
|
|
"clone " +
|
|
|
|
|
"--progress " +
|
2012-04-22 12:32:55 +00:00
|
|
|
|
"--no-checkout " +
|
2012-03-29 00:44:26 +00:00
|
|
|
|
"\"" + RemoteUrl + "\" \"" + TargetFolder + "\"");
|
|
|
|
|
}
|
2012-04-11 18:07:34 +00:00
|
|
|
|
|
2011-08-27 15:53:17 +00:00
|
|
|
|
this.git.StartInfo.RedirectStandardError = true;
|
2011-08-26 20:47:46 +00:00
|
|
|
|
this.git.Start ();
|
2011-12-18 16:10:06 +00:00
|
|
|
|
|
2011-08-27 15:53:17 +00:00
|
|
|
|
double percentage = 1.0;
|
2011-08-27 15:10:39 +00:00
|
|
|
|
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
2011-12-30 00:44:35 +00:00
|
|
|
|
|
|
|
|
|
DateTime last_change = DateTime.Now;
|
|
|
|
|
TimeSpan change_interval = new TimeSpan (0, 0, 0, 1);
|
|
|
|
|
|
2011-08-27 15:53:17 +00:00
|
|
|
|
while (!this.git.StandardError.EndOfStream) {
|
|
|
|
|
string line = this.git.StandardError.ReadLine ();
|
|
|
|
|
Match match = progress_regex.Match (line);
|
|
|
|
|
|
|
|
|
|
double number = 0.0;
|
2011-08-27 15:10:39 +00:00
|
|
|
|
if (match.Success) {
|
|
|
|
|
number = double.Parse (match.Groups [1].Value);
|
2011-08-27 15:53:17 +00:00
|
|
|
|
|
|
|
|
|
// The cloning progress consists of two stages: the "Compressing
|
|
|
|
|
// objects" stage which we count as 20% of the total progress, and
|
|
|
|
|
// the "Receiving objects" stage which we count as the last 80%
|
|
|
|
|
if (line.Contains ("|"))
|
|
|
|
|
// "Receiving objects" stage
|
2011-12-30 00:44:35 +00:00
|
|
|
|
number = (number / 100 * 80 + 20);
|
2011-08-27 15:53:17 +00:00
|
|
|
|
else
|
|
|
|
|
// "Compressing objects" stage
|
|
|
|
|
number = (number / 100 * 20);
|
2012-04-17 09:05:47 +00:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
SparkleHelpers.DebugInfo ("Fetcher", line);
|
2011-08-27 15:53:17 +00:00
|
|
|
|
}
|
2012-04-17 09:05:47 +00:00
|
|
|
|
|
|
|
|
|
|
2011-08-27 15:53:17 +00:00
|
|
|
|
if (number >= percentage) {
|
|
|
|
|
percentage = number;
|
2011-12-30 00:44:35 +00:00
|
|
|
|
|
|
|
|
|
if (DateTime.Compare (last_change, DateTime.Now.Subtract (change_interval)) < 0) {
|
|
|
|
|
base.OnProgressChanged (percentage);
|
|
|
|
|
last_change = DateTime.Now;
|
|
|
|
|
}
|
2011-08-27 15:53:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-26 20:47:46 +00:00
|
|
|
|
this.git.WaitForExit ();
|
2012-02-26 15:58:09 +00:00
|
|
|
|
SparkleHelpers.DebugInfo ("Git", "Exit code: " + this.git.ExitCode);
|
|
|
|
|
|
|
|
|
|
if (this.git.ExitCode == 0) {
|
|
|
|
|
while (percentage < 100) {
|
|
|
|
|
percentage += 25;
|
|
|
|
|
|
|
|
|
|
if (percentage >= 100)
|
|
|
|
|
break;
|
2012-04-22 12:32:55 +00:00
|
|
|
|
|
2012-03-01 23:56:44 +00:00
|
|
|
|
Thread.Sleep (500);
|
2012-02-26 15:58:09 +00:00
|
|
|
|
base.OnProgressChanged (percentage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.OnProgressChanged (100);
|
2011-12-30 00:44:35 +00:00
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
InstallConfiguration ();
|
|
|
|
|
InstallExcludeRules ();
|
2012-02-09 01:46:25 +00:00
|
|
|
|
AddWarnings ();
|
2012-02-26 15:58:09 +00:00
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
return true;
|
2012-02-26 15:58:09 +00:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
2011-05-16 20:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-22 12:32:55 +00:00
|
|
|
|
public override bool IsFetchedRepoEmpty {
|
|
|
|
|
get {
|
|
|
|
|
SparkleGit git = new SparkleGit (TargetFolder, "rev-list --reverse HEAD");
|
|
|
|
|
git.Start ();
|
|
|
|
|
|
|
|
|
|
// Reading the standard output HAS to go before
|
|
|
|
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
|
|
|
string output = git.StandardOutput.ReadToEnd ();
|
|
|
|
|
git.WaitForExit ();
|
|
|
|
|
|
|
|
|
|
return (output.Length < 40);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void EnableFetchedRepoCrypto (string password)
|
2012-02-09 01:46:25 +00:00
|
|
|
|
{
|
2012-04-22 12:32:55 +00:00
|
|
|
|
// Define the crypto filter in the config
|
|
|
|
|
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
|
|
|
|
|
string config = File.ReadAllText (repo_config_file_path);
|
2011-11-28 13:40:34 +00:00
|
|
|
|
|
2012-04-22 12:32:55 +00:00
|
|
|
|
string n = Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
config += "[filter \"crypto\"]" + n +
|
|
|
|
|
"\tsmudge = openssl enc -d -aes-256-cbc -base64 -S " + this.crypto_salt + " -pass file:.git/password" + n +
|
|
|
|
|
"\tclean = openssl enc -e -aes-256-cbc -base64 -S " + this.crypto_salt + " -pass file:.git/password" + n;
|
|
|
|
|
|
|
|
|
|
File.WriteAllText (repo_config_file_path, config);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pass all files through the crypto filter
|
|
|
|
|
string git_attributes_file_path = SparkleHelpers.CombineMore (
|
|
|
|
|
TargetFolder, ".git", "info", "attributes");
|
|
|
|
|
|
|
|
|
|
File.WriteAllText (git_attributes_file_path, "* filter=crypto");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Store the password
|
|
|
|
|
string password_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "password");
|
|
|
|
|
File.WriteAllText (password_file_path, password.Trim ());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool IsFetchedRepoPasswordCorrect (string password)
|
|
|
|
|
{
|
|
|
|
|
string password_check_file_path = Path.Combine (TargetFolder, ".sparkleshare");
|
|
|
|
|
|
|
|
|
|
if (!File.Exists (password_check_file_path)) {
|
|
|
|
|
SparkleGit git = new SparkleGit (TargetFolder, "show HEAD:.sparkleshare");
|
|
|
|
|
git.Start ();
|
|
|
|
|
|
|
|
|
|
// Reading the standard output HAS to go before
|
|
|
|
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
|
|
|
string output = git.StandardOutput.ReadToEnd ();
|
|
|
|
|
git.WaitForExit ();
|
|
|
|
|
|
|
|
|
|
if (git.ExitCode != 0) {
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
File.WriteAllText (password_check_file_path, output);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Process process = new Process () {
|
|
|
|
|
EnableRaisingEvents = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
process.StartInfo.WorkingDirectory = TargetFolder;
|
|
|
|
|
process.StartInfo.UseShellExecute = false;
|
|
|
|
|
process.StartInfo.RedirectStandardOutput = true;
|
|
|
|
|
process.StartInfo.CreateNoWindow = true;
|
|
|
|
|
|
|
|
|
|
process.StartInfo.FileName = "openssl";
|
|
|
|
|
process.StartInfo.Arguments = "enc -d -aes-256-cbc -base64 -S " + this.crypto_salt +
|
|
|
|
|
" -pass pass:\"" + password + "\" -in " + password_check_file_path;
|
|
|
|
|
|
|
|
|
|
process.Start ();
|
2011-11-28 13:40:34 +00:00
|
|
|
|
|
2012-02-09 01:46:25 +00:00
|
|
|
|
// Reading the standard output HAS to go before
|
|
|
|
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
2012-04-22 12:32:55 +00:00
|
|
|
|
process.StandardOutput.ReadToEnd ();
|
|
|
|
|
process.WaitForExit ();
|
2011-11-28 13:40:34 +00:00
|
|
|
|
|
2012-04-22 12:32:55 +00:00
|
|
|
|
if (process.ExitCode == 0) {
|
|
|
|
|
File.Delete (password_check_file_path);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2011-11-28 13:40:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-09 01:46:25 +00:00
|
|
|
|
|
2011-08-26 20:47:46 +00:00
|
|
|
|
public override void Stop ()
|
|
|
|
|
{
|
2012-04-11 10:51:53 +00:00
|
|
|
|
try {
|
2012-04-11 11:04:42 +00:00
|
|
|
|
this.git.Close ();
|
2011-08-26 20:47:46 +00:00
|
|
|
|
this.git.Kill ();
|
|
|
|
|
this.git.Dispose ();
|
2012-04-11 10:51:53 +00:00
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
2012-04-18 09:52:45 +00:00
|
|
|
|
SparkleHelpers.DebugInfo ("Fetcher", "Failed to dispose properly: " + e.Message);
|
2011-08-26 20:47:46 +00:00
|
|
|
|
}
|
2012-04-18 09:52:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-22 12:32:55 +00:00
|
|
|
|
public override void Complete ()
|
2012-04-18 09:52:45 +00:00
|
|
|
|
{
|
2012-04-22 12:32:55 +00:00
|
|
|
|
SparkleGit git = new SparkleGit (TargetFolder, "checkout HEAD");
|
|
|
|
|
git.Start ();
|
|
|
|
|
|
|
|
|
|
// Reading the standard output HAS to go before
|
|
|
|
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
|
|
|
git.StandardOutput.ReadToEnd ();
|
|
|
|
|
git.WaitForExit ();
|
2011-08-26 20:47:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
// Install the user's name and email and some config into
|
|
|
|
|
// the newly cloned repository
|
|
|
|
|
private void InstallConfiguration ()
|
|
|
|
|
{
|
2012-02-09 01:46:25 +00:00
|
|
|
|
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
|
2012-04-22 12:32:55 +00:00
|
|
|
|
string config = File.ReadAllText (repo_config_file_path);
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
2011-07-29 22:03:45 +00:00
|
|
|
|
string n = Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
config = config.Replace ("[core]" + n,
|
2012-04-26 17:32:00 +00:00
|
|
|
|
"[core]" + n +
|
|
|
|
|
"\tquotepath = false" + n + // Show special characters in the logs
|
2012-01-18 01:50:47 +00:00
|
|
|
|
"\tpackedGitLimit = 128m" + n +
|
2012-04-26 17:32:00 +00:00
|
|
|
|
"\tautocrlf = false" + n +
|
|
|
|
|
"\tsafecrlf = false" + n +
|
2012-01-18 01:50:47 +00:00
|
|
|
|
"\tpackedGitWindowSize = 128m" + n);
|
|
|
|
|
|
|
|
|
|
config = config.Replace ("[remote \"origin\"]" + n,
|
|
|
|
|
"[pack]" + n +
|
|
|
|
|
"\tdeltaCacheSize = 128m" + n +
|
|
|
|
|
"\tpackSizeLimit = 128m" + n +
|
|
|
|
|
"\twindowMemory = 128m" + n +
|
|
|
|
|
"[remote \"origin\"]" + n);
|
2011-07-29 22:03:45 +00:00
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
// Be case sensitive explicitly to work on Mac
|
|
|
|
|
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
|
|
|
|
|
|
|
|
|
// Ignore permission changes
|
|
|
|
|
config = config.Replace ("filemode = true", "filemode = false");
|
2011-07-29 22:03:45 +00:00
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
// Write the config to the file
|
2012-04-22 12:32:55 +00:00
|
|
|
|
File.WriteAllText (repo_config_file_path, config);
|
2012-04-11 10:51:53 +00:00
|
|
|
|
SparkleHelpers.DebugInfo ("Fetcher", "Added configuration to '" + repo_config_file_path + "'");
|
2011-05-16 20:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add a .gitignore file to the repo
|
|
|
|
|
private void InstallExcludeRules ()
|
|
|
|
|
{
|
2012-01-11 22:15:13 +00:00
|
|
|
|
DirectoryInfo info = Directory.CreateDirectory (
|
2012-02-09 01:46:25 +00:00
|
|
|
|
SparkleHelpers.CombineMore (TargetFolder, ".git", "info"));
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
2012-01-11 22:15:13 +00:00
|
|
|
|
// File that lists the files we want git to ignore
|
2012-01-29 18:12:43 +00:00
|
|
|
|
string exclude_rules_file_path = Path.Combine (info.FullName, "exclude");
|
|
|
|
|
TextWriter writer = new StreamWriter (exclude_rules_file_path);
|
2011-05-16 20:19:58 +00:00
|
|
|
|
|
2012-01-31 21:30:23 +00:00
|
|
|
|
foreach (string exclude_rule in ExcludeRules)
|
|
|
|
|
writer.WriteLine (exclude_rule);
|
2012-01-16 19:57:11 +00:00
|
|
|
|
|
2011-05-16 20:19:58 +00:00
|
|
|
|
writer.Close ();
|
2012-01-11 22:15:13 +00:00
|
|
|
|
|
|
|
|
|
|
2012-01-13 20:18:16 +00:00
|
|
|
|
// File that lists the files we want don't want git to compress.
|
2012-01-11 22:15:13 +00:00
|
|
|
|
// Not compressing the already compressed files saves us memory
|
2012-01-13 20:18:16 +00:00
|
|
|
|
// usage and increases speed
|
2012-01-11 22:15:13 +00:00
|
|
|
|
string no_compression_rules_file_path = Path.Combine (info.FullName, "attributes");
|
|
|
|
|
writer = new StreamWriter (no_compression_rules_file_path);
|
|
|
|
|
|
|
|
|
|
// Images
|
|
|
|
|
writer.WriteLine ("*.jpg -delta");
|
|
|
|
|
writer.WriteLine ("*.jpeg -delta");
|
|
|
|
|
writer.WriteLine ("*.JPG -delta");
|
|
|
|
|
writer.WriteLine ("*.JPEG -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.png -delta");
|
|
|
|
|
writer.WriteLine ("*.PNG -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.tiff -delta");
|
|
|
|
|
writer.WriteLine ("*.TIFF -delta");
|
|
|
|
|
|
|
|
|
|
// Audio
|
|
|
|
|
writer.WriteLine ("*.flac -delta");
|
|
|
|
|
writer.WriteLine ("*.FLAC -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.mp3 -delta");
|
|
|
|
|
writer.WriteLine ("*.MP3 -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.ogg -delta");
|
|
|
|
|
writer.WriteLine ("*.OGG -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.oga -delta");
|
|
|
|
|
writer.WriteLine ("*.OGA -delta");
|
|
|
|
|
|
|
|
|
|
// Video
|
|
|
|
|
writer.WriteLine ("*.avi -delta");
|
|
|
|
|
writer.WriteLine ("*.AVI -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.mov -delta");
|
|
|
|
|
writer.WriteLine ("*.MOV -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.mpg -delta");
|
|
|
|
|
writer.WriteLine ("*.MPG -delta");
|
|
|
|
|
writer.WriteLine ("*.mpeg -delta");
|
|
|
|
|
writer.WriteLine ("*.MPEG -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.mkv -delta");
|
|
|
|
|
writer.WriteLine ("*.MKV -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.ogv -delta");
|
|
|
|
|
writer.WriteLine ("*.OGV -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.ogx -delta");
|
|
|
|
|
writer.WriteLine ("*.OGX -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.webm -delta");
|
|
|
|
|
writer.WriteLine ("*.WEBM -delta");
|
|
|
|
|
|
|
|
|
|
// Archives
|
|
|
|
|
writer.WriteLine ("*.zip -delta");
|
|
|
|
|
writer.WriteLine ("*.ZIP -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.gz -delta");
|
|
|
|
|
writer.WriteLine ("*.GZ -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.bz -delta");
|
|
|
|
|
writer.WriteLine ("*.BZ -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.bz2 -delta");
|
|
|
|
|
writer.WriteLine ("*.BZ2 -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.rpm -delta");
|
|
|
|
|
writer.WriteLine ("*.RPM -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.deb -delta");
|
|
|
|
|
writer.WriteLine ("*.DEB -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.tgz -delta");
|
|
|
|
|
writer.WriteLine ("*.TGZ -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.rar -delta");
|
|
|
|
|
writer.WriteLine ("*.RAR -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.ace -delta");
|
|
|
|
|
writer.WriteLine ("*.ACE -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.7z -delta");
|
|
|
|
|
writer.WriteLine ("*.7Z -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.pak -delta");
|
|
|
|
|
writer.WriteLine ("*.PAK -delta");
|
|
|
|
|
|
|
|
|
|
writer.WriteLine ("*.tar -delta");
|
|
|
|
|
writer.WriteLine ("*.TAR -delta");
|
|
|
|
|
|
|
|
|
|
writer.Close ();
|
2011-05-16 20:19:58 +00:00
|
|
|
|
}
|
2012-04-22 12:32:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void AddWarnings ()
|
|
|
|
|
{
|
|
|
|
|
SparkleGit git = new SparkleGit (TargetFolder,
|
|
|
|
|
"config --global core.excludesfile");
|
|
|
|
|
|
|
|
|
|
git.Start ();
|
|
|
|
|
|
|
|
|
|
// Reading the standard output HAS to go before
|
|
|
|
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
|
|
|
string output = git.StandardOutput.ReadToEnd ().Trim ();
|
|
|
|
|
git.WaitForExit ();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty (output))
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
this.warnings.Add ("You seem to have a system wide ‘gitignore’ file, this may affect SparkleShare files.");
|
|
|
|
|
}
|
2011-05-16 20:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|