mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07: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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SourceGit.Models {
|
namespace SourceGit.Models {
|
||||||
|
@ -40,5 +41,11 @@ namespace SourceGit.Models {
|
||||||
|
|
||||||
CommitMessages.Insert(0, message);
|
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
|
#region MERGE_BAR
|
||||||
private void UpdateMergeBar(List<Models.Change> changes) {
|
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");
|
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");
|
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");
|
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");
|
txtConflictTip.Text = App.Text("Conflict.Merge");
|
||||||
} else {
|
} else {
|
||||||
mergeNavigator.Visibility = Visibility.Collapsed;
|
mergeNavigator.Visibility = Visibility.Collapsed;
|
||||||
|
@ -1162,14 +1162,15 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
private async void ContinueMerge(object sender, RoutedEventArgs e) {
|
private async void ContinueMerge(object sender, RoutedEventArgs e) {
|
||||||
var cherryPickMerge = Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD");
|
var cherryPickMerge = Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD");
|
||||||
var rebaseMerge = Path.Combine(repo.GitDir, "REBASE_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 revertMerge = Path.Combine(repo.GitDir, "REVERT_HEAD");
|
||||||
var otherMerge = Path.Combine(repo.GitDir, "MERGE_HEAD");
|
var otherMerge = Path.Combine(repo.GitDir, "MERGE_HEAD");
|
||||||
|
|
||||||
var mode = "";
|
var mode = "";
|
||||||
if (File.Exists(cherryPickMerge)) {
|
if (File.Exists(cherryPickMerge)) {
|
||||||
mode = "cherry-pick";
|
mode = "cherry-pick";
|
||||||
} else if (File.Exists(rebaseMerge)) {
|
} else if (File.Exists(rebaseMerge) && Directory.Exists(rebaseMergeFolder)) {
|
||||||
mode = "rebase";
|
mode = "rebase";
|
||||||
} else if (File.Exists(revertMerge)) {
|
} else if (File.Exists(revertMerge)) {
|
||||||
mode = "revert";
|
mode = "revert";
|
||||||
|
@ -1191,14 +1192,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
if (succ) {
|
if (succ) {
|
||||||
(pages.Get("working_copy") as WorkingCopy).ClearMessage();
|
(pages.Get("working_copy") as WorkingCopy).ClearMessage();
|
||||||
if (mode == "rebase") {
|
if (mode == "rebase") {
|
||||||
var rebaseTempFolder = Path.Combine(repo.GitDir, "rebase-apply");
|
if (File.Exists(rebaseMerge)) File.Delete(rebaseMerge);
|
||||||
if (Directory.Exists(rebaseTempFolder)) Directory.Delete(rebaseTempFolder);
|
if (Directory.Exists(rebaseMergeFolder)) Directory.Delete(rebaseMergeFolder);
|
||||||
|
|
||||||
var rebaseFile = Path.Combine(repo.GitDir, "REBASE_HEAD");
|
|
||||||
if (File.Exists(rebaseFile)) File.Delete(rebaseFile);
|
|
||||||
|
|
||||||
var rebaseMergeFolder = Path.Combine(repo.GitDir, "rebase-merge");
|
|
||||||
if (Directory.Exists(rebaseMergeFolder)) Directory.Delete(rebaseMergeFolder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue