mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-28 23:54:59 +00:00
enhance: show git errors when failed to get the repository root dir of given path (#397)
This commit is contained in:
parent
963916219f
commit
b16d267c9b
14 changed files with 40 additions and 39 deletions
|
@ -10,16 +10,22 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.Init}"/>
|
||||
<Grid Margin="0,16,8,0" RowDefinitions="28,28" ColumnDefinitions="120,*">
|
||||
<Grid Margin="0,16,8,0" ColumnDefinitions="100,*">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Init.Path}"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"/>
|
||||
Text="{DynamicResource Text.Init.Path}"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1"
|
||||
Text="{Binding TargetPath}"/>
|
||||
Text="{Binding TargetPath}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1"
|
||||
Text="{DynamicResource Text.Init.Tip}"
|
||||
Foreground="{DynamicResource Brush.FG2}"/>
|
||||
Foreground="{DynamicResource Brush.FG2}"
|
||||
Text="{Binding Reason}"
|
||||
TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -279,14 +279,14 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
||||
if (string.IsNullOrEmpty(root))
|
||||
var test = new Commands.QueryRepositoryRootPath(path).ReadToEnd();
|
||||
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
|
||||
{
|
||||
ViewModels.Welcome.Instance.InitRepository(path, parent);
|
||||
ViewModels.Welcome.Instance.InitRepository(path, parent, test.StdErr);
|
||||
return;
|
||||
}
|
||||
|
||||
var normalizedPath = root.Replace("\\", "/");
|
||||
var normalizedPath = test.StdOut.Trim().Replace("\\", "/");
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
|
||||
|
|
|
@ -55,14 +55,14 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
||||
if (string.IsNullOrEmpty(root))
|
||||
var test = new Commands.QueryRepositoryRootPath(path).ReadToEnd();
|
||||
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
|
||||
{
|
||||
ViewModels.Welcome.Instance.InitRepository(path, parent);
|
||||
ViewModels.Welcome.Instance.InitRepository(path, parent, test.StdErr);
|
||||
return;
|
||||
}
|
||||
|
||||
var normalizedPath = root.Replace("\\", "/");
|
||||
var normalizedPath = test.StdOut.Trim().Replace("\\", "/");
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, false);
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue