1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>showindex.c</title>
<link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/docco.css">
<style type="text/css">
a.fnlink {text-decoration: none}
a.fnlink:hover {text-decoration: underline}
</style>
</head>
<body>
<div id='container'>
<div id="background"></div>
<div id="jump_to">
Jump To …
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="../../#v0.13.0">API Docs</a>
<a class="source" href="general.html">general.c</a>
<a class="source" href="showindex.html">showindex.c</a>
</div>
</div>
</div>
<table cellspacing=0 cellpadding=0>
<thead>
<tr>
<th class=docs><h1>showindex.c</h1></th>
<th class=code></th>
</tr>
</thead>
<tbody>
<tr id='section-1'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-1">¶</a>
</div>
</td>
<td class=code>
<div class='highlight'><pre><span class="cp">#include <git2.h></span>
<span class="cp">#include <stdio.h></span>
<span class="kt">int</span> <span class="nf">main</span> <span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">git_repository</span> <span class="o">*</span><span class="n">repo</span><span class="p">;</span>
<span class="n">git_index</span> <span class="o">*</span><span class="n">index</span><span class="p">;</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">ecount</span><span class="p">;</span>
<span class="n">git_index_entry</span> <span class="o">**</span><span class="n">entries</span><span class="p">;</span>
<span class="n">git_oid</span> <span class="n">oid</span><span class="p">;</span>
<span class="kt">char</span> <span class="n">out</span><span class="p">[</span><span class="mi">41</span><span class="p">];</span>
<span class="n">out</span><span class="p">[</span><span class="mi">40</span><span class="p">]</span> <span class="o">=</span> <span class="sc">'\0'</span><span class="p">;</span>
<span class="n"><a name="git_repository_open-1" class="fnlink" href="../../#v0.13.0/group/repository/git_repository_open">git_repository_open</a></span><span class="p">(</span><span class="o">&</span><span class="n">repo</span><span class="p">,</span> <span class="s">"/opt/libgit2-test/.git"</span><span class="p">);</span>
<span class="n"><a name="git_repository_index-2" class="fnlink" href="../../#v0.13.0/group/repository/git_repository_index">git_repository_index</a></span><span class="p">(</span><span class="o">&</span><span class="n">index</span><span class="p">,</span> <span class="n">repo</span><span class="p">);</span>
<span class="n"><a name="git_index_read-6" class="fnlink" href="../../#v0.13.0/group/index/git_index_read">git_index_read</a></span><span class="p">(</span><span class="n">index</span><span class="p">);</span>
<span class="n">ecount</span> <span class="o">=</span> <span class="n"><a name="git_index_entrycount-8" class="fnlink" href="../../#v0.13.0/group/index/git_index_entrycount">git_index_entrycount</a></span><span class="p">(</span><span class="n">index</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">ecount</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
<span class="n">git_index_entry</span> <span class="o">*</span><span class="n">e</span> <span class="o">=</span> <span class="n"><a name="git_index_get-7" class="fnlink" href="../../#v0.13.0/group/index/git_index_get">git_index_get</a></span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">i</span><span class="p">);</span>
<span class="n">oid</span> <span class="o">=</span> <span class="n">e</span><span class="o">-></span><span class="n">oid</span><span class="p">;</span>
<span class="n"><a name="git_oid_fmt-4" class="fnlink" href="../../#v0.13.0/group/oid/git_oid_fmt">git_oid_fmt</a></span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="o">&</span><span class="n">oid</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"File Path: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">e</span><span class="o">-></span><span class="n">path</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" Blob SHA: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"File Size: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">file_size</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" Device: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">dev</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" Inode: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">ino</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" UID: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">uid</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" GID: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">gid</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" ctime: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">ctime</span><span class="p">.</span><span class="n">seconds</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">" mtime: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">e</span><span class="o">-></span><span class="n">mtime</span><span class="p">.</span><span class="n">seconds</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
<span class="p">}</span>
<span class="n"><a name="git_index_free-5" class="fnlink" href="../../#v0.13.0/group/index/git_index_free">git_index_free</a></span><span class="p">(</span><span class="n">index</span><span class="p">);</span>
<span class="n"><a name="git_repository_free-3" class="fnlink" href="../../#v0.13.0/group/repository/git_repository_free">git_repository_free</a></span><span class="p">(</span><span class="n">repo</span><span class="p">);</span>
<span class="p">}</span></pre></div>
</td>
</tr>
</table>
</div>
</body>
|