-
-
Save Trolldemorted/8d909ca7bac61afd5c80256805589380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed partial class MainPage : Page | |
{ | |
struct git_repository { }; | |
String HOME = ApplicationData.Current.LocalFolder.Path; | |
[DllImport(@"git2")] static extern void git_libgit2_init(); | |
[DllImport(@"git2")] static extern void git_libgit2_shutdown(); | |
[DllImport(@"git2")] static extern unsafe int git_repository_init(git_repository **repo, IntPtr given_repo, bool bare); | |
[DllImport(@"git2")] static extern unsafe int git_repository_free(git_repository* repo); | |
public MainPage() | |
{ | |
this.InitializeComponent(); | |
} | |
private unsafe void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
git_repository* repo; | |
int error; | |
git_libgit2_init(); | |
Debug.WriteLine("executing git init in the app's LocalState folder: {0}", HOME); | |
IntPtr path = Marshal.StringToHGlobalAnsi(HOME); | |
error = git_repository_init(&repo, path, false); | |
Debug.WriteLine("init returned value: {0}", error); | |
git_repository_free(repo); | |
Debug.WriteLine("repository freed"); | |
git_libgit2_shutdown(); | |
Debug.WriteLine("libgit2 shutdown"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment