repo: Fix edge case where ID may be empty
This commit is contained in:
parent
f753e0e36c
commit
6dd657a086
|
@ -157,8 +157,7 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool HasRemoteChanges
|
public override bool HasRemoteChanges {
|
||||||
{
|
|
||||||
get {
|
get {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "ls-remote \"" + RemoteUrl + "\" master");
|
SparkleGit git = new SparkleGit (LocalPath, "ls-remote \"" + RemoteUrl + "\" master");
|
||||||
|
@ -393,17 +392,6 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Removes unneeded objects
|
|
||||||
/* private void CollectGarbage ()
|
|
||||||
{
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "gc");
|
|
||||||
git.Start ();
|
|
||||||
git.WaitForExit ();
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Garbage collected.");
|
|
||||||
} */
|
|
||||||
|
|
||||||
|
|
||||||
// Commits the made changes
|
// Commits the made changes
|
||||||
private void Commit (string message)
|
private void Commit (string message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,7 +109,7 @@ namespace SparkleLib {
|
||||||
{
|
{
|
||||||
if (!this.channels.Contains (channel) && IsConnected) {
|
if (!this.channels.Contains (channel) && IsConnected) {
|
||||||
SparkleHelpers.DebugInfo ("Listener",
|
SparkleHelpers.DebugInfo ("Listener",
|
||||||
"Subscribing to channel " + channel);
|
"Subscribing to channel " + channel + " on " + Server);
|
||||||
|
|
||||||
this.channels.Add (channel);
|
this.channels.Add (channel);
|
||||||
AlsoListenToInternal (channel);
|
AlsoListenToInternal (channel);
|
||||||
|
|
|
@ -205,9 +205,6 @@ namespace SparkleLib {
|
||||||
|
|
||||||
protected override void AlsoListenToInternal (string folder_identifier)
|
protected override void AlsoListenToInternal (string folder_identifier)
|
||||||
{
|
{
|
||||||
SparkleHelpers.DebugInfo ("ListenerTcp",
|
|
||||||
"Subscribing to channel " + folder_identifier + " on " + Server);
|
|
||||||
|
|
||||||
string to_send = "subscribe " + folder_identifier + "\n";
|
string to_send = "subscribe " + folder_identifier + "\n";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -139,20 +139,24 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public string Identifier {
|
public string Identifier {
|
||||||
get {
|
get {
|
||||||
if (this.identifier == null) {
|
if (this.identifier != null)
|
||||||
string id_path = Path.Combine (LocalPath, ".sparkleshare");
|
return this.identifier;
|
||||||
|
|
||||||
if (File.Exists (id_path)) {
|
string id_path = Path.Combine (LocalPath, ".sparkleshare");
|
||||||
this.identifier = File.ReadAllText (id_path).Trim ();
|
|
||||||
|
|
||||||
} else {
|
if (File.Exists (id_path))
|
||||||
this.identifier = ComputeIdentifier ();
|
this.identifier = File.ReadAllText (id_path).Trim ();
|
||||||
File.WriteAllText (id_path, this.identifier);
|
|
||||||
File.SetAttributes (id_path, FileAttributes.Hidden);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.identifier;
|
if (this.identifier != null && this.identifier.Length > 0) {
|
||||||
|
return this.identifier;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.identifier = ComputeIdentifier ();
|
||||||
|
File.WriteAllText (id_path, this.identifier);
|
||||||
|
File.SetAttributes (id_path, FileAttributes.Hidden);
|
||||||
|
|
||||||
|
return this.identifier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue