fetcher git: Refactor
This commit is contained in:
parent
a2353405dd
commit
eb543fef5e
|
@ -136,7 +136,6 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (number >= percentage) {
|
if (number >= percentage) {
|
||||||
percentage = number;
|
percentage = number;
|
||||||
|
|
||||||
|
@ -164,6 +163,7 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
InstallConfiguration ();
|
InstallConfiguration ();
|
||||||
InstallExcludeRules ();
|
InstallExcludeRules ();
|
||||||
|
InstallAttributeRules ();
|
||||||
|
|
||||||
AddWarnings ();
|
AddWarnings ();
|
||||||
|
|
||||||
|
@ -322,13 +322,13 @@ namespace SparkleLib.Git {
|
||||||
public void InstallGitBinConfiguration ()
|
public void InstallGitBinConfiguration ()
|
||||||
{
|
{
|
||||||
string [] settings = new string [] {
|
string [] settings = new string [] {
|
||||||
|
"core.bigFileThreshold 8g",
|
||||||
"config filter.bin.clean \"git bin clean %f\"",
|
"config filter.bin.clean \"git bin clean %f\"",
|
||||||
"config filter.bin.smudge \"git bin smudge\"",
|
"config filter.bin.smudge \"git bin smudge\"",
|
||||||
|
"git-bin.chunkSize 1m",
|
||||||
"git-bin.s3bucket \"your bucket name\"",
|
"git-bin.s3bucket \"your bucket name\"",
|
||||||
"git-bin.s3key \"your key\"",
|
"git-bin.s3key \"your key\"",
|
||||||
"git-bin.s3secretKey \"your secret key\"",
|
"git-bin.s3secretKey \"your secret key\""
|
||||||
"git-bin.chunkSize 1m",
|
|
||||||
"core.bigFileThreshold 8g"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (string setting in settings) {
|
foreach (string setting in settings) {
|
||||||
|
@ -342,27 +342,27 @@ namespace SparkleLib.Git {
|
||||||
// Add a .gitignore file to the repo
|
// Add a .gitignore file to the repo
|
||||||
private void InstallExcludeRules ()
|
private void InstallExcludeRules ()
|
||||||
{
|
{
|
||||||
DirectoryInfo info = Directory.CreateDirectory (
|
// Compile a list of files we want Git to ignore
|
||||||
SparkleHelpers.CombineMore (TargetFolder, ".git", "info"));
|
string exclude_rules_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "info", "exclude");
|
||||||
|
|
||||||
// File that lists the files we want git to ignore
|
|
||||||
string exclude_rules_file_path = Path.Combine (info.FullName, "exclude");
|
|
||||||
TextWriter writer = new StreamWriter (exclude_rules_file_path);
|
TextWriter writer = new StreamWriter (exclude_rules_file_path);
|
||||||
|
|
||||||
foreach (string exclude_rule in ExcludeRules)
|
foreach (string exclude_rule in ExcludeRules)
|
||||||
writer.WriteLine (exclude_rule);
|
writer.WriteLine (exclude_rule);
|
||||||
|
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string git_attributes_file_path = Path.Combine (info.FullName, "attributes");
|
private void InstallAttributeRules ()
|
||||||
writer = new StreamWriter (git_attributes_file_path);
|
{
|
||||||
|
string attribute_rules_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "info", "attributes");
|
||||||
|
TextWriter writer = new StreamWriter (attribute_rules_file_path);
|
||||||
|
|
||||||
if (this.use_git_bin) {
|
if (this.use_git_bin) {
|
||||||
writer.WriteLine ("* filter=bin binary");
|
writer.WriteLine ("* filter=bin binary");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Compile a list of files we don't want git to compress.
|
// Compile a list of files we don't want Git to compress.
|
||||||
// Not compressing already compressed files decreases memory usage and increases speed
|
// Not compressing already compressed files decreases memory usage and increases speed
|
||||||
string [] extensions = new string [] {
|
string [] extensions = new string [] {
|
||||||
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
||||||
|
|
Loading…
Reference in a new issue