Fix hang on commit logs > 4096 bytes
This commit is contained in:
parent
0005a76388
commit
6153d40f89
|
@ -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,70 +290,79 @@ 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>";
|
||||||
|
|
||||||
if (change_set.Edited.Count > 0) {
|
} else if (change_set.IsFileDump) {
|
||||||
|
|
||||||
event_entry += "<dt>Edited</dt>";
|
event_entry += "<dt>Dumped a lot of files</dt>";
|
||||||
|
|
||||||
foreach (string file_path in change_set.Edited) {
|
} else {
|
||||||
|
|
||||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
if (change_set.Edited.Count > 0) {
|
||||||
name, file_path);
|
|
||||||
|
|
||||||
if (File.Exists (absolute_file_path)) {
|
event_entry += "<dt>Edited</dt>";
|
||||||
|
|
||||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
foreach (string file_path in change_set.Edited) {
|
||||||
|
|
||||||
} else {
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
event_entry += "<dd>" + file_path + "</dd>";
|
if (File.Exists (absolute_file_path)) {
|
||||||
|
|
||||||
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
event_entry += "<dd>" + file_path + "</dd>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (change_set.Added.Count > 0) {
|
||||||
|
|
||||||
if (change_set.Added.Count > 0) {
|
event_entry += "<dt>Added</dt>";
|
||||||
|
|
||||||
event_entry += "<dt>Added</dt>";
|
foreach (string file_path in change_set.Added) {
|
||||||
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
foreach (string file_path in change_set.Added) {
|
if (File.Exists (absolute_file_path)) {
|
||||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
|
||||||
name, file_path);
|
|
||||||
|
|
||||||
if (File.Exists (absolute_file_path)) {
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
} else {
|
||||||
|
|
||||||
} else {
|
event_entry += "<dd>" + file_path + "</dd>";
|
||||||
|
|
||||||
event_entry += "<dd>" + file_path + "</dd>";
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (change_set.Deleted.Count > 0) {
|
||||||
|
|
||||||
if (change_set.Deleted.Count > 0) {
|
event_entry += "<dt>Deleted</dt>";
|
||||||
|
|
||||||
event_entry += "<dt>Deleted</dt>";
|
foreach (string file_path in change_set.Deleted) {
|
||||||
|
|
||||||
foreach (string file_path in change_set.Deleted) {
|
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
||||||
|
name, file_path);
|
||||||
|
|
||||||
string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
if (File.Exists (absolute_file_path)) {
|
||||||
name, file_path);
|
|
||||||
|
|
||||||
if (File.Exists (absolute_file_path)) {
|
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
||||||
|
|
||||||
event_entry += "<dd><a href='" + absolute_file_path + "'>" + file_path + "</a></dd>";
|
} else {
|
||||||
|
|
||||||
} else {
|
event_entry += "<dd>" + file_path + "</dd>";
|
||||||
|
|
||||||
event_entry += "<dd>" + file_path + "</dd>";
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue