Skip to content

Commit

Permalink
fixed sync when no staged files exist
Browse files Browse the repository at this point in the history
  • Loading branch information
zezba9000 committed Nov 21, 2017
1 parent 1251ea9 commit 8b2e5d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GitCommander/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

public static class VersionInfo
{
public const string version = "1.0.1";
public const string version = "1.0.2";

#if DEBUG
public const string versionType = version + "d";
Expand Down
25 changes: 15 additions & 10 deletions GitItGUI.UI/Screens/RepoTabs/ChangesTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void stageFile()
});
}

RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand Down Expand Up @@ -340,7 +341,8 @@ private void StagedFileButton_Click(object sender, RoutedEventArgs e)
button.Click += UnstagedFileButton_Click;
});
}


RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand Down Expand Up @@ -372,7 +374,8 @@ private void stageAllMenuItem_Click(object sender, RoutedEventArgs e)
unstagedChangesListBox.Items.Clear();
});
}


RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand All @@ -398,6 +401,7 @@ private void unstageAllMenuItem_Click(object sender, RoutedEventArgs e)
});
}

RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand Down Expand Up @@ -451,6 +455,7 @@ private void stageSelectedMenuItem_Click(object sender, RoutedEventArgs e)
});
}

RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand Down Expand Up @@ -498,6 +503,7 @@ private void unstageSelectedMenuItem_Click(object sender, RoutedEventArgs e)
});
}

RepoScreen.singleton.repoManager.QuickRefresh();
MainWindow.singleton.HideProcessingOverlay();
});
}
Expand Down Expand Up @@ -942,22 +948,21 @@ private void syncButton_Click(object sender, RoutedEventArgs e)
}

// validate changes exist
string msg = null;
bool needCommit = false;
bool changesExist = RepoScreen.singleton.repoManager.ChangesExist();
if (changesExist && stagedChangesListBox.Items.Count == 0)
if (changesExist && stagedChangesListBox.Items.Count != 0)
{
MainWindow.singleton.ShowMessageOverlay("Error", "There are no staged files to commit");
return;
// prep commit message
if (!PrepCommitMessage(out msg)) return;
needCommit = true;
}

// prep commit message
string msg = null;
if (changesExist && !PrepCommitMessage(out msg)) return;

// process
MainWindow.singleton.ShowProcessingOverlay();
RepoScreen.singleton.repoManager.dispatcher.InvokeAsync(delegate()
{
if (changesExist && !RepoScreen.singleton.repoManager.CommitStagedChanges(msg, false))
if (needCommit && !RepoScreen.singleton.repoManager.CommitStagedChanges(msg, false))
{
RepoScreen.singleton.Refresh();
MainWindow.singleton.ShowMessageOverlay("Error", "Failed to commit changes");
Expand Down
2 changes: 1 addition & 1 deletion GitItGUI.UI/VersionInfo.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<VersionInfo>
<AppVersion>1.0.1</AppVersion>
<AppVersion>1.0.2</AppVersion>
</VersionInfo>

0 comments on commit 8b2e5d2

Please sign in to comment.