Skip to content

Commit

Permalink
add detection of git merge tool and git credential helper
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed Dec 21, 2013
1 parent 99455ee commit b55fe06
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
17 changes: 14 additions & 3 deletions UI/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,26 @@
</UserControl.Resources>
<Grid Background="White">
<Label Content="Browse or type the path to Git for Windows (git.exe)" Height="28" HorizontalAlignment="Left" Margin="7,12,0,0" Name="label1" VerticalAlignment="Top" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="12,38,0,0" Name="txtGitExePath" VerticalAlignment="Top" Width="368" MouseDown="txtGitExePath_MouseDown" KeyUp="txtGitExePath_KeyUp" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="12,38,0,0" Name="txtGitExePath" VerticalAlignment="Top" Width="368" KeyUp="txtGitExePath_KeyUp" />
<Button Content="Browse ..." Height="23" HorizontalAlignment="Left" Margin="386,38,0,0" Name="btnBrowse" VerticalAlignment="Top" Width="75" Click="btnBrowse_Click" />
<Label Content="." Height="28" HorizontalAlignment="Left" Margin="12,66,0,0" Name="txtMessage" VerticalAlignment="Top" />

<TextBlock Height="27" HorizontalAlignment="Left" Margin="388,71,0,0" VerticalAlignment="Top">
<Hyperlink Name="txtGitSite" NavigateUri="http://git-scm.com/" RequestNavigate="Hyperlink_RequestNavigate">Download Git</Hyperlink>
</TextBlock>

<Label Content="Git User Name" Height="28" HorizontalAlignment="Left" Margin="12,100,0,0" Name="label2" VerticalAlignment="Top" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="105,105,0,0" Name="txtUserName" VerticalAlignment="Top" Width="275" />
<Label Content="Git User Email" Height="28" HorizontalAlignment="Left" Margin="12,129,0,0" Name="label3" VerticalAlignment="Top" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="105,134,0,0" Name="txtUserEmail" VerticalAlignment="Top" Width="275" />
<Button Content="Verify" Height="23" HorizontalAlignment="Left" Margin="386,71,0,0" Name="btnVerify" VerticalAlignment="Top" Width="75" Click="btnVerify_Click" Visibility="Hidden" />
<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="12,172,0,0" Name="btnCancel" VerticalAlignment="Top" Width="75" Click="btnCancel_Click" />
<Button Content="OK" Height="23" HorizontalAlignment="Left" Margin="105,172,0,0" Name="btnOK" VerticalAlignment="Top" Width="75" Click="btnOK_Click"/>
<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="12,217,0,0" Name="btnCancel" VerticalAlignment="Top" Width="75" Click="btnCancel_Click" />
<Button Content="OK" Height="23" HorizontalAlignment="Left" Margin="105,217,0,0" Name="btnOK" VerticalAlignment="Top" Width="75" Click="btnOK_Click"/>
<TextBlock Height="36" HorizontalAlignment="Left" Margin="16,167,0,0" VerticalAlignment="Top">
<Hyperlink Name="txtGitCredentialHelper" NavigateUri="http://gitcredentialstore.codeplex.com/" RequestNavigate="Hyperlink_RequestNavigate">Credential Helper</Hyperlink>
<LineBreak/>
<Hyperlink Name="txtGitMergeTool" NavigateUri="http://git-scm.com/docs/git-mergetool" RequestNavigate="Hyperlink_RequestNavigate">Merge Tool</Hyperlink>
</TextBlock>

</Grid>
</UserControl>
19 changes: 19 additions & 0 deletions UI/Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;

namespace GitScc.UI
{
Expand Down Expand Up @@ -50,6 +51,18 @@ private void CheckGitBash()
txtUserName.Text = result.Output;
result = GitBash.Run("config --global user.email", "");
txtUserEmail.Text = result.Output;
result = GitBash.Run("config --global credential.helper", "");
var msg = string.IsNullOrWhiteSpace(result.Output) ?
"Click here to install Windows Credential for Git":
"Git credential helper is installed";
txtGitCredentialHelper.Inlines.Clear();
txtGitCredentialHelper.Inlines.Add(msg);
result = GitBash.Run("config --global merge.tool", "");
msg = string.IsNullOrWhiteSpace(result.Output) ?
"Git merge tool is not configured." :
"Git merge tool is " + result.Output;
txtGitMergeTool.Inlines.Clear();
txtGitMergeTool.Inlines.Add(msg);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -124,6 +137,12 @@ private void txtGitExePath_KeyUp(object sender, KeyEventArgs e)
}
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}


}
}

0 comments on commit b55fe06

Please sign in to comment.