Fix hang on commit logs > 4096 bytes
This commit is contained in:
parent
17d07bb2eb
commit
5e84a9cfe0
|
@ -27,6 +27,7 @@ namespace SparkleLib {
|
||||||
public DateTime DateTime;
|
public DateTime DateTime;
|
||||||
public string Hash;
|
public string Hash;
|
||||||
public bool IsMerge;
|
public bool IsMerge;
|
||||||
|
public bool IsFileDump;
|
||||||
|
|
||||||
public List <string> Added;
|
public List <string> Added;
|
||||||
public List <string> Deleted;
|
public List <string> Deleted;
|
||||||
|
@ -43,6 +44,9 @@ namespace SparkleLib {
|
||||||
MovedFrom = new List <string> ();
|
MovedFrom = new List <string> ();
|
||||||
MovedTo = new List <string> ();
|
MovedTo = new List <string> ();
|
||||||
|
|
||||||
|
IsMerge = false;
|
||||||
|
IsFileDump = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -962,14 +962,16 @@ namespace SparkleLib {
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
count = 30;
|
count = 30;
|
||||||
|
|
||||||
|
|
||||||
List <SparkleCommit> commits = new List <SparkleCommit> ();
|
List <SparkleCommit> commits = new List <SparkleCommit> ();
|
||||||
|
|
||||||
SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw --date=iso");
|
SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw --date=iso");
|
||||||
git_log.Start ();
|
git_log.Start ();
|
||||||
|
|
||||||
|
// Reading the standard output HAS to go before
|
||||||
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
||||||
|
string output = git_log.StandardOutput.ReadToEnd ();
|
||||||
git_log.WaitForExit ();
|
git_log.WaitForExit ();
|
||||||
|
|
||||||
string output = git_log.StandardOutput.ReadToEnd ();
|
|
||||||
string [] lines = output.Split ("\n".ToCharArray ());
|
string [] lines = output.Split ("\n".ToCharArray ());
|
||||||
|
|
||||||
List <string> entries = new List <string> ();
|
List <string> entries = new List <string> ();
|
||||||
|
@ -1038,6 +1040,7 @@ namespace SparkleLib {
|
||||||
int.Parse (match.Groups [9].Value));
|
int.Parse (match.Groups [9].Value));
|
||||||
|
|
||||||
string [] entry_lines = log_entry.Split ("\n".ToCharArray ());
|
string [] entry_lines = log_entry.Split ("\n".ToCharArray ());
|
||||||
|
int change_count = 0;
|
||||||
foreach (string entry_line in entry_lines) {
|
foreach (string entry_line in entry_lines) {
|
||||||
|
|
||||||
if (entry_line.StartsWith (":")) {
|
if (entry_line.StartsWith (":")) {
|
||||||
|
@ -1059,6 +1062,18 @@ namespace SparkleLib {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
change_count++;
|
||||||
|
|
||||||
|
if (change_count > 50) {
|
||||||
|
|
||||||
|
commit.Added.Clear ();
|
||||||
|
commit.Edited.Clear ();
|
||||||
|
commit.Deleted.Clear ();
|
||||||
|
|
||||||
|
commit.IsFileDump = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,9 +290,16 @@ namespace SparkleShare {
|
||||||
|
|
||||||
string event_entry = "<dl>";
|
string event_entry = "<dl>";
|
||||||
|
|
||||||
if (change_set.IsMerge)
|
if (change_set.IsMerge) {
|
||||||
|
|
||||||
event_entry += "<dt>Merged a branch</dt>";
|
event_entry += "<dt>Merged a branch</dt>";
|
||||||
|
|
||||||
|
} else if (change_set.IsFileDump) {
|
||||||
|
|
||||||
|
event_entry += "<dt>Dumped a lot of files</dt>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
if (change_set.Edited.Count > 0) {
|
if (change_set.Edited.Count > 0) {
|
||||||
|
|
||||||
event_entry += "<dt>Edited</dt>";
|
event_entry += "<dt>Edited</dt>";
|
||||||
|
@ -361,6 +368,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
event_entry += "</dl>";
|
event_entry += "</dl>";
|
||||||
|
|
||||||
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
||||||
|
|
Loading…
Reference in a new issue