mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
fix: Improve in-progress rebase handling (#933)
* fix: Improve in-progress rebase handling * fix: Close merge popup even if there are conflicts (#941)
This commit is contained in:
parent
c2950ad209
commit
a4157e11e6
4 changed files with 20 additions and 9 deletions
|
@ -107,8 +107,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
_gitDir = repo.GitDir;
|
_gitDir = repo.GitDir;
|
||||||
|
|
||||||
var stoppedSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha")).Trim();
|
var stoppedSHAPath = Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha");
|
||||||
StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result() ?? new Models.Commit() { SHA = stoppedSHA };
|
if (File.Exists(stoppedSHAPath))
|
||||||
|
{
|
||||||
|
var stoppedSHA = File.ReadAllText(stoppedSHAPath).Trim();
|
||||||
|
StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result() ?? new Models.Commit() { SHA = stoppedSHA };
|
||||||
|
}
|
||||||
|
|
||||||
var ontoSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "onto")).Trim();
|
var ontoSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "onto")).Trim();
|
||||||
Onto = new Commands.QuerySingleCommit(repo.FullPath, ontoSHA).Result() ?? new Models.Commit() { SHA = ontoSHA };
|
Onto = new Commands.QuerySingleCommit(repo.FullPath, ontoSHA).Result() ?? new Models.Commit() { SHA = ontoSHA };
|
||||||
|
|
|
@ -61,9 +61,9 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
var succ = new Commands.Merge(_repo.FullPath, _sourceName, SelectedMode.Arg, SetProgressDescription).Exec();
|
new Commands.Merge(_repo.FullPath, _sourceName, SelectedMode.Arg, SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ namespace SourceGit.ViewModels
|
||||||
var inProgress = null as InProgressContext;
|
var inProgress = null as InProgressContext;
|
||||||
if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD")))
|
if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD")))
|
||||||
inProgress = new CherryPickInProgress(_repo);
|
inProgress = new CherryPickInProgress(_repo);
|
||||||
else if (File.Exists(Path.Combine(_repo.GitDir, "REBASE_HEAD")) && Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge")))
|
else if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge")) || Directory.Exists(Path.Combine(_repo.GitDir, "rebase-apply")))
|
||||||
inProgress = new RebaseInProgress(_repo);
|
inProgress = new RebaseInProgress(_repo);
|
||||||
else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD")))
|
else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD")))
|
||||||
inProgress = new RevertInProgress(_repo);
|
inProgress = new RevertInProgress(_repo);
|
||||||
|
@ -291,7 +291,7 @@ namespace SourceGit.ViewModels
|
||||||
var inProgress = null as InProgressContext;
|
var inProgress = null as InProgressContext;
|
||||||
if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD")))
|
if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD")))
|
||||||
inProgress = new CherryPickInProgress(_repo);
|
inProgress = new CherryPickInProgress(_repo);
|
||||||
else if (File.Exists(Path.Combine(_repo.GitDir, "REBASE_HEAD")) && Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge")))
|
else if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge")) || Directory.Exists(Path.Combine(_repo.GitDir, "rebase-apply")))
|
||||||
inProgress = new RebaseInProgress(_repo);
|
inProgress = new RebaseInProgress(_repo);
|
||||||
else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD")))
|
else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD")))
|
||||||
inProgress = new RevertInProgress(_repo);
|
inProgress = new RevertInProgress(_repo);
|
||||||
|
|
|
@ -598,11 +598,18 @@
|
||||||
<Grid ColumnDefinitions="*,Auto">
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||||
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Rebase}"/>
|
<TextBlock FontWeight="Bold" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Rebase}"/>
|
||||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="{DynamicResource Brush.ConflictForeground}" Text="{DynamicResource Text.InProgress.Rebase.StoppedAt}"/>
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="{DynamicResource Brush.ConflictForeground}"
|
||||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="DarkOrange" Text="{Binding StoppedAt.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" ToolTip.Tip="{Binding StoppedAt}"/>
|
Text="{DynamicResource Text.InProgress.Rebase.StoppedAt}"
|
||||||
|
IsVisible="{Binding StoppedAt, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Foreground="DarkOrange"
|
||||||
|
Text="{Binding StoppedAt.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
||||||
|
IsVisible="{Binding StoppedAt, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||||
|
ToolTip.Tip="{Binding StoppedAt}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Button Grid.Column="1" Classes="flat" FontWeight="Regular" BorderThickness="0" Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Click="OnSkipInProgress"/>
|
<Button Grid.Column="1" Classes="flat" FontWeight="Regular" BorderThickness="0"
|
||||||
|
Content="{DynamicResource Text.Repository.Skip}" Padding="8,2" Click="OnSkipInProgress"
|
||||||
|
IsVisible="{Binding StoppedAt, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue