git fetcher: Always make sure .git/info/ exists

This commit is contained in:
Hylke Bons 2017-02-02 22:54:57 +00:00
parent b70b40a8ff
commit a6e6b99d25

View file

@ -246,8 +246,11 @@ namespace Sparkles.Git {
git_config_smudge.StartAndWaitForExit (); git_config_smudge.StartAndWaitForExit ();
git_config_clean.StartAndWaitForExit (); git_config_clean.StartAndWaitForExit ();
string git_info_path = Path.Combine (TargetFolder, ".git", "info");
Directory.CreateDirectory (git_info_path);
// Store the password, TODO: 600 permissions // Store the password, TODO: 600 permissions
string password_file_path = Path.Combine (TargetFolder, ".git", "info", "encryption_password"); string password_file_path = Path.Combine (git_info_path, "encryption_password");
File.WriteAllText (password_file_path, password.SHA256 (password_salt)); File.WriteAllText (password_file_path, password.SHA256 (password_salt));
} }
@ -358,9 +361,7 @@ namespace Sparkles.Git {
void InstallExcludeRules () void InstallExcludeRules ()
{ {
string git_info_path = Path.Combine (TargetFolder, ".git", "info"); string git_info_path = Path.Combine (TargetFolder, ".git", "info");
Directory.CreateDirectory (git_info_path);
if (!Directory.Exists (git_info_path))
Directory.CreateDirectory (git_info_path);
string exclude_rules = string.Join (Environment.NewLine, ExcludeRules); string exclude_rules = string.Join (Environment.NewLine, ExcludeRules);
string exclude_rules_file_path = Path.Combine (git_info_path, "exclude"); string exclude_rules_file_path = Path.Combine (git_info_path, "exclude");
@ -371,8 +372,10 @@ namespace Sparkles.Git {
void InstallAttributeRules () void InstallAttributeRules ()
{ {
string git_attributes_file_path = Path.Combine (TargetFolder, ".git", "info", "attributes"); string git_info_path = Path.Combine (TargetFolder, ".git", "info");
Directory.CreateDirectory (Path.GetDirectoryName (git_attributes_file_path)); Directory.CreateDirectory (git_info_path);
string git_attributes_file_path = Path.Combine (git_info_path, "attributes");
if (FetchedRepoStorageType == StorageType.LargeFiles) { if (FetchedRepoStorageType == StorageType.LargeFiles) {
File.WriteAllText (git_attributes_file_path, "* filter=lfs diff=lfs merge=lfs -text"); File.WriteAllText (git_attributes_file_path, "* filter=lfs diff=lfs merge=lfs -text");