mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
optimize<Dashboard>: ISSUE #3 Rebase merge request detected but there is no rebase in progress.
This commit is contained in:
parent
e779d1b65e
commit
a19f81a708
2 changed files with 16 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SourceGit.Models {
|
||||
|
@ -40,5 +41,11 @@ namespace SourceGit.Models {
|
|||
|
||||
CommitMessages.Insert(0, message);
|
||||
}
|
||||
|
||||
public bool ExistsInGitDir(string file) {
|
||||
if (string.IsNullOrEmpty(file)) return false;
|
||||
string fullpath = System.IO.Path.Combine(GitDir, file);
|
||||
return Directory.Exists(fullpath) || File.Exists(fullpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1129,13 +1129,13 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
#region MERGE_BAR
|
||||
private void UpdateMergeBar(List<Models.Change> changes) {
|
||||
if (File.Exists(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD"))) {
|
||||
if (repo.ExistsInGitDir("CHERRY_PICK_HEAD")) {
|
||||
txtConflictTip.Text = App.Text("Conflict.CherryPick");
|
||||
} else if (File.Exists(Path.Combine(repo.GitDir, "REBASE_HEAD"))) {
|
||||
} else if (repo.ExistsInGitDir("REBASE_HEAD") && repo.ExistsInGitDir("rebase-merge")) {
|
||||
txtConflictTip.Text = App.Text("Conflict.Rebase");
|
||||
} else if (File.Exists(Path.Combine(repo.GitDir, "REVERT_HEAD"))) {
|
||||
} else if (repo.ExistsInGitDir("REVERT_HEAD")) {
|
||||
txtConflictTip.Text = App.Text("Conflict.Revert");
|
||||
} else if (File.Exists(Path.Combine(repo.GitDir, "MERGE_HEAD"))) {
|
||||
} else if (repo.ExistsInGitDir("MERGE_HEAD")) {
|
||||
txtConflictTip.Text = App.Text("Conflict.Merge");
|
||||
} else {
|
||||
mergeNavigator.Visibility = Visibility.Collapsed;
|
||||
|
@ -1163,13 +1163,14 @@ namespace SourceGit.Views.Widgets {
|
|||
private async void ContinueMerge(object sender, RoutedEventArgs e) {
|
||||
var cherryPickMerge = Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD");
|
||||
var rebaseMerge = Path.Combine(repo.GitDir, "REBASE_HEAD");
|
||||
var rebaseMergeFolder = Path.Combine(repo.GitDir, "rebase-merge");
|
||||
var revertMerge = Path.Combine(repo.GitDir, "REVERT_HEAD");
|
||||
var otherMerge = Path.Combine(repo.GitDir, "MERGE_HEAD");
|
||||
|
||||
var mode = "";
|
||||
if (File.Exists(cherryPickMerge)) {
|
||||
mode = "cherry-pick";
|
||||
} else if (File.Exists(rebaseMerge)) {
|
||||
} else if (File.Exists(rebaseMerge) && Directory.Exists(rebaseMergeFolder)) {
|
||||
mode = "rebase";
|
||||
} else if (File.Exists(revertMerge)) {
|
||||
mode = "revert";
|
||||
|
@ -1191,13 +1192,7 @@ namespace SourceGit.Views.Widgets {
|
|||
if (succ) {
|
||||
(pages.Get("working_copy") as WorkingCopy).ClearMessage();
|
||||
if (mode == "rebase") {
|
||||
var rebaseTempFolder = Path.Combine(repo.GitDir, "rebase-apply");
|
||||
if (Directory.Exists(rebaseTempFolder)) Directory.Delete(rebaseTempFolder);
|
||||
|
||||
var rebaseFile = Path.Combine(repo.GitDir, "REBASE_HEAD");
|
||||
if (File.Exists(rebaseFile)) File.Delete(rebaseFile);
|
||||
|
||||
var rebaseMergeFolder = Path.Combine(repo.GitDir, "rebase-merge");
|
||||
if (File.Exists(rebaseMerge)) File.Delete(rebaseMerge);
|
||||
if (Directory.Exists(rebaseMergeFolder)) Directory.Delete(rebaseMergeFolder);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue