Allow empty folders to be added by putting a hidden file in each of them before committing
This commit is contained in:
parent
ac3abe5b8c
commit
d0244e0da6
|
@ -165,6 +165,8 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override bool AnyDifferences {
|
public override bool AnyDifferences {
|
||||||
get {
|
get {
|
||||||
|
FillEmptyDirectories (LocalPath);
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
||||||
|
@ -509,6 +511,22 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Git doesn't track empty directories, so this method
|
||||||
|
// fills them all with a hidden empty file
|
||||||
|
private void FillEmptyDirectories (string path)
|
||||||
|
{
|
||||||
|
foreach (string child_path in Directory.GetDirectories (path)) {
|
||||||
|
if (path.EndsWith (".git") || path.EndsWith (".notes"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
FillEmptyDirectories (child_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.GetFiles (path).Length == 0)
|
||||||
|
File.Create (Path.Combine (path, ".empty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates a pretty commit message based on what has changed
|
// Creates a pretty commit message based on what has changed
|
||||||
private string FormatCommitMessage ()
|
private string FormatCommitMessage ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue