1 // gitdlltest.cpp : Defines the entry point for the console application.
7 int output(int ret
, char * name
)
10 printf("Fail \t%s\r\n",name
);
12 printf("Success\t%s\r\n",name
);
15 int _tmain(int argc
, _TCHAR
* argv
[])
20 memset(&hash
,0,sizeof(GIT_HASH
));
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");
34 ret
= git_get_commit_first_parent(&commit
,&list
);
35 output(ret
, "git_get_commit_first_parent");
39 ret
= git_get_commit_next_parent(&list
, outhash
);
41 printf("parent count %d\r\n",i
);
44 ret
= git_open_diff(&diff
, "-M -C --stat");
45 output(ret
, "git_open_diff");
49 ret
= git_diff(diff
, outhash
, commit
.m_hash
,&file
, &count
,0);
50 output(ret
, "git_diff");
59 ret
= git_get_diff_file(diff
,file
,i
,&newname
, &oldname
, &status
,
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
);
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");
77 while( git_get_log_nextcommit(handle
,&commit
,0) == 0)
79 //printf("%s\r\n",commit.m_Subject);
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");