fix SparkleRepo.FormatCommitMessage ()

This commit is contained in:
wimh 2010-11-27 00:06:49 +01:00 committed by Hylke Bons
parent b0f3ae4dc2
commit abd338b5c4

View file

@ -1012,6 +1012,15 @@ namespace SparkleLib {
private string FormatCommitMessage () private string FormatCommitMessage ()
{ {
/// RepositoryStatus contains the following properties (all HashSet<string>)
/// * Added ---> added and staged
/// * MergeConflict --->
/// * Missing ---> removed but not staged
/// * Modified ---> modified but not staged
/// * Removed ---> removed and staged
/// * Staged ---> modified and staged
/// * Untracked ---> added but not staged
/// Because we create the commitmessage, we only need to consider the staged changes
RepositoryStatus status = Index.Status; RepositoryStatus status = Index.Status;
string file_name = ""; string file_name = "";
@ -1028,12 +1037,12 @@ namespace SparkleLib {
} }
if (status.Modified.Count > 0) { if (status.Staged.Count > 0) {
foreach (string modified in status.Modified) { foreach (string modified in status.Staged) {
file_name = modified; file_name = modified;
break; break;
} }
message = "/ " + file_name + ""; message = "/ " + file_name + "";
@ -1044,14 +1053,14 @@ namespace SparkleLib {
foreach (string removed in status.Removed) { foreach (string removed in status.Removed) {
file_name = removed; file_name = removed;
break; break;
} }
message = "- " + file_name + ""; message = "- " + file_name + "";
} }
int changes_count = (status.Added.Count + int changes_count = (status.Added.Count +
status.Modified.Count + status.Staged.Count +
status.Removed.Count); status.Removed.Count);
if (changes_count > 1) if (changes_count > 1)