From 7235d9fa3069a1f3e2ecf97340ab35d655617a6c Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 14 May 2011 18:11:31 +0100 Subject: [PATCH] repo: use the first commit hash as an id for the repo and use that as the channel name' did not match any files --- SparkleLib/SparkleRepo.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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...");