Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add an installer based on GitPad's installer #1

Merged
merged 2 commits into from

2 participants

@paulcbetts

This PR adds a simple "installer" which just takes the git-credential-winstore.exe file and stuffs it off in %AppData%, then runs git config to install itself.

@anurse

This looks like a copypasta artifact from GitPad ;)

hwhoops

@anurse
Owner

Other than the copypasta referenced above, looks good! Will merge after it's fixed.

@anurse anurse merged commit 59999d2 into anurse:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 17, 2012
  1. @paulcbetts
  2. @paulcbetts

    hwhoops.

    paulcbetts authored
This page is out of date. Refresh to see the latest.
View
37 git-credential-winstore/Program.cs
@@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
+using System.Windows.Forms;
namespace Git.Credential.WinStore
{
@@ -23,9 +26,6 @@ static void Main(string[] args)
{
TryLaunchDebugger(ref args);
- // Read arguments
- IDictionary<string, string> parameters = ReadGitParameters();
-
// Parse command
Func<IDictionary<string, string>, IEnumerable<Tuple<string, string>>> command = null;
string cmd;
@@ -37,14 +37,14 @@ static void Main(string[] args)
// specified in key-value pairs.
cmd = parameters.GetOrDefault("cmd", "get");
#else
- WriteUsage();
+ InstallTheApp();
return;
#endif
}
- else
- {
- cmd = args[0];
- }
+
+ cmd = args[0];
+
+ IDictionary<string, string> parameters = ReadGitParameters();
if (!_commands.TryGetValue(cmd, out command))
{
@@ -54,6 +54,7 @@ static void Main(string[] args)
IDictionary<string, string> response = command(parameters).ToDictionary(
t => t.Item1,
t => t.Item2);
+
WriteGitParameters(response);
}
@@ -96,6 +97,26 @@ private static void WriteUsage()
Console.Error.WriteLine("See the following link for more info: http://www.manpagez.com/man/1/git-credential-cache/");
}
+ private static void InstallTheApp()
+ {
+ if (MessageBox.Show("Do you want to install git-credential-winstore to prompt for passwords?",
+ "Installing git-credential-winstore", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+
+ var target = new DirectoryInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore"));
+ if (!target.Exists)
+ {
+ target.Create();
+ }
+
+ var dest = new FileInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore\git-credential-winstore.exe"));
+ File.Copy(Assembly.GetExecutingAssembly().Location, dest.FullName, true);
+
+ Process.Start("git", "config --global credential.helper !~/AppData/Roaming/GitCredStore/git-credential-winstore");
+ }
+
static IEnumerable<Tuple<string, string>> GetCommand(IDictionary<string, string> args)
{
// Build the URL
View
1  git-credential-winstore/git-credential-winstore.csproj
@@ -36,6 +36,7 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Something went wrong with that request. Please try again.