diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index bbb819bd..8bb5f8ec 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -186,7 +186,7 @@ namespace SparkleLib { else server_type = NotificationServerType.Own; - this.listener = new SparkleListenerIrc (Domain, RemoteName, server_type); + this.listener = new SparkleListenerIrc (Domain, Identifier, server_type); // ...fetch remote changes every 60 seconds if that fails this.remote_timer = new Timer () { @@ -266,6 +266,22 @@ namespace SparkleLib { } + public string Identifier { + get { + + // Because git computes a hash based on content, + // author, and timestamp; it is unique enough to + // use the hash of the first commit as an identifier + // for our folder + SparkleGit git = new SparkleGit (LocalPath, "log --reverse -1 --format=%H"); + git.Start (); + git.WaitForExit (); + + return git.StandardOutput.ReadToEnd ().Trim (); + } + } + + private void CheckForRemoteChanges () { SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");