New hidden registry setting: ShellMenuAccelerators
[TortoiseGit.git] / ext / gitdlltest / gitdlltest.cpp
blob778e9609003b4387e7a1b02f235e56b13a1d6461
1 // gitdlltest.cpp : Defines the entry point for the console application.
2 //
4 #include "stdafx.h"
5 #include "gitdll.h"
7 int output(int ret, char * name)
9 if(ret)
10 printf("Fail \t%s\r\n",name);
11 else
12 printf("Success\t%s\r\n",name);
13 return 0;
15 int _tmain(int argc, _TCHAR* argv[])
17 int count;
18 GIT_HASH hash;
19 GIT_COMMIT commit;
20 memset(&hash,0,sizeof(GIT_HASH));
21 int ret;
22 ret=git_init();
23 output(ret,"git_init");
24 ret=git_get_sha1("master",hash);
25 output(ret,"git_get_sha1");
26 ret=git_get_sha1("head",hash);
27 output(ret,"git_get_sha1");
28 ret=git_get_commit_from_hash(&commit, hash);
29 output(ret,"git_get_commit_from_hash");
31 GIT_COMMIT_LIST list;
32 GIT_HASH outhash;
33 int i=0;
34 ret = git_get_commit_first_parent(&commit,&list);
35 output(ret, "git_get_commit_first_parent");
36 while(list)
38 i++;
39 ret = git_get_commit_next_parent(&list, outhash);
41 printf("parent count %d\r\n",i);
43 GIT_DIFF diff;
44 ret = git_open_diff(&diff, "-M -C --stat");
45 output(ret, "git_open_diff");
47 GIT_FILE file;
49 ret = git_diff(diff, outhash, commit.m_hash,&file, &count,0);
50 output(ret, "git_diff");
52 for(i =0;i<count;i++)
54 char * newname;
55 char * oldname;
56 int status;
57 int IsBin;
58 int inc, dec;
59 ret = git_get_diff_file(diff,file,i,&newname, &oldname, &status,
60 &IsBin, &inc, &dec);
62 ret = git_diff_flush(diff);
63 output(ret, "git_diff_flush");
64 // ret = git_close_diff(diff);
65 // output(ret, "git_close_diff");
68 git_free_commit(&commit);
71 GIT_HANDLE handle;
72 ret=git_open_log(&handle,"--stat -c -- \"build.txt\"");
73 output(ret,"git_open_log");
74 ret=git_get_log_firstcommit(handle);
75 output(ret,"git_get_log_firstcommit");
76 count = 0;
77 while( git_get_log_nextcommit(handle,&commit,0) == 0)
79 //printf("%s\r\n",commit.m_Subject);
80 count ++;
81 git_free_commit(&commit);
83 printf("commit number %d\r\n",count);
84 ret=git_close_log(handle);
87 output(ret,"git_close_log");
88 return ret;