summaryrefslogtreecommitdiff
path: root/ex/v1.6.0/describe.html
diff options
context:
space:
mode:
Diffstat (limited to 'ex/v1.6.0/describe.html')
-rw-r--r--ex/v1.6.0/describe.html268
1 files changed, 268 insertions, 0 deletions
diff --git a/ex/v1.6.0/describe.html b/ex/v1.6.0/describe.html
new file mode 100644
index 000000000..6abcb5e92
--- /dev/null
+++ b/ex/v1.6.0/describe.html
@@ -0,0 +1,268 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>describe.c</title>
+ <link rel="stylesheet" href="../css.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 &hellip;
+ <div id="jump_wrapper">
+ <div id="jump_page">
+ <a class="source" href="../../#v1.6.0">API Docs</a>
+ <a class="source" href="add.html">add.c</a>
+ <a class="source" href="args.html">args.c</a>
+ <a class="source" href="blame.html">blame.c</a>
+ <a class="source" href="cat-file.html">cat-file.c</a>
+ <a class="source" href="checkout.html">checkout.c</a>
+ <a class="source" href="clone.html">clone.c</a>
+ <a class="source" href="commit.html">commit.c</a>
+ <a class="source" href="common.html">common.c</a>
+ <a class="source" href="config.html">config.c</a>
+ <a class="source" href="describe.html">describe.c</a>
+ <a class="source" href="diff.html">diff.c</a>
+ <a class="source" href="fetch.html">fetch.c</a>
+ <a class="source" href="for-each-ref.html">for-each-ref.c</a>
+ <a class="source" href="general.html">general.c</a>
+ <a class="source" href="index-pack.html">index-pack.c</a>
+ <a class="source" href="init.html">init.c</a>
+ <a class="source" href="lg2.html">lg2.c</a>
+ <a class="source" href="log.html">log.c</a>
+ <a class="source" href="ls-files.html">ls-files.c</a>
+ <a class="source" href="ls-remote.html">ls-remote.c</a>
+ <a class="source" href="merge.html">merge.c</a>
+ <a class="source" href="push.html">push.c</a>
+ <a class="source" href="remote.html">remote.c</a>
+ <a class="source" href="rev-list.html">rev-list.c</a>
+ <a class="source" href="rev-parse.html">rev-parse.c</a>
+ <a class="source" href="show-index.html">show-index.c</a>
+ <a class="source" href="stash.html">stash.c</a>
+ <a class="source" href="status.html">status.c</a>
+ <a class="source" href="tag.html">tag.c</a>
+ </div>
+ </div>
+ </div>
+ <table cellspacing=0 cellpadding=0>
+ <thead>
+ <tr>
+ <th class=docs><h1>describe.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">&#182;</a>
+ </div>
+
+ </td>
+ <td class=code>
+ <div class='highlight'><pre><span></span><span class="cm">/*</span>
+<span class="cm"> * libgit2 &quot;describe&quot; example - shows how to describe commits</span>
+<span class="cm"> *</span>
+<span class="cm"> * Written by the libgit2 contributors</span>
+<span class="cm"> *</span>
+<span class="cm"> * To the extent possible under law, the author(s) have dedicated all copyright</span>
+<span class="cm"> * and related and neighboring rights to this software to the public domain</span>
+<span class="cm"> * worldwide. This software is distributed without any warranty.</span>
+<span class="cm"> *</span>
+<span class="cm"> * You should have received a copy of the CC0 Public Domain Dedication along</span>
+<span class="cm"> * with this software. If not, see</span>
+<span class="cm"> * &lt;http://creativecommons.org/publicdomain/zero/1.0/&gt;.</span>
+<span class="cm"> */</span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;common.h&quot;</span><span class="cp"></span></pre></div>
+ </td>
+ </tr>
+ <tr id='section-2'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-2">&#182;</a>
+ </div>
+ <p>The following example partially reimplements the <code>git describe</code> command
+and some of its options.</p>
+
+<p>These commands should work:</p>
+
+<ul>
+<li>Describe HEAD with default options (<code>describe</code>)</li>
+<li>Describe specified revision (<code>describe master~2</code>)</li>
+<li>Describe specified revisions (<code>describe master~2 HEAD~3</code>)</li>
+<li>Describe HEAD with dirty state suffix (<code>describe --dirty=*</code>)</li>
+<li>Describe consider all refs (<code>describe --all master</code>)</li>
+<li>Describe consider lightweight tags (<code>describe --tags temp-tag</code>)</li>
+<li>Describe show non-default abbreviated size (<code>describe --abbrev=10</code>)</li>
+<li>Describe always output the long format if matches a tag (<code>describe --long v1.0</code>)</li>
+<li>Describe consider only tags of specified pattern (<code>describe --match v*-release</code>)</li>
+<li>Describe show the fallback result (<code>describe --always</code>)</li>
+<li>Describe follow only the first parent commit (<code>describe --first-parent</code>)</li>
+</ul>
+
+<p>The command line parsing logic is simplified and doesn&#39;t handle
+all of the use cases.</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre></pre></div>
+ </td>
+ </tr>
+ <tr id='section-3'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-3">&#182;</a>
+ </div>
+ <p>describe_options represents the parsed command line options</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre><span class="k">struct</span> <span class="n">describe_options</span> <span class="p">{</span>
+ <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">commits</span><span class="p">;</span>
+ <span class="kt">size_t</span> <span class="n">commit_count</span><span class="p">;</span>
+ <span class="n">git_describe_options</span> <span class="n">describe_options</span><span class="p">;</span>
+ <span class="n">git_describe_format_options</span> <span class="n">format_options</span><span class="p">;</span>
+<span class="p">};</span>
+
+<span class="k">static</span> <span class="kt">void</span> <span class="nf">opts_add_commit</span><span class="p">(</span><span class="k">struct</span> <span class="n">describe_options</span> <span class="o">*</span><span class="n">opts</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">commit</span><span class="p">)</span>
+<span class="p">{</span>
+ <span class="kt">size_t</span> <span class="n">sz</span><span class="p">;</span>
+
+ <span class="n">assert</span><span class="p">(</span><span class="n">opts</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">);</span>
+
+ <span class="n">sz</span> <span class="o">=</span> <span class="o">++</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span> <span class="o">*</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span> <span class="o">=</span> <span class="n">xrealloc</span><span class="p">((</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span><span class="p">,</span> <span class="n">sz</span><span class="p">);</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span><span class="p">[</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">commit</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="k">static</span> <span class="kt">void</span> <span class="nf">do_describe_single</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="k">struct</span> <span class="n">describe_options</span> <span class="o">*</span><span class="n">opts</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">rev</span><span class="p">)</span>
+<span class="p">{</span>
+ <span class="n">git_object</span> <span class="o">*</span><span class="n">commit</span><span class="p">;</span>
+ <span class="n">git_describe_result</span> <span class="o">*</span><span class="n">describe_result</span><span class="p">;</span>
+ <span class="n">git_buf</span> <span class="n">buf</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">0</span> <span class="p">};</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="n">rev</span><span class="p">)</span> <span class="p">{</span>
+ <span class="n">check_lg2</span><span class="p">(</span><span class="n"><a name="git_revparse_single-6" class="fnlink" href="../../#v1.6.0/group/revparse/git_revparse_single">git_revparse_single</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">commit</span><span class="p">,</span> <span class="n">repo</span><span class="p">,</span> <span class="n">rev</span><span class="p">),</span>
+ <span class="s">&quot;Failed to lookup rev&quot;</span><span class="p">,</span> <span class="n">rev</span><span class="p">);</span>
+
+ <span class="n">check_lg2</span><span class="p">(</span><span class="n"><a name="git_describe_commit-3" class="fnlink" href="../../#v1.6.0/group/describe/git_describe_commit">git_describe_commit</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">describe_result</span><span class="p">,</span> <span class="n">commit</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">),</span>
+ <span class="s">&quot;Failed to describe rev&quot;</span><span class="p">,</span> <span class="n">rev</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="k">else</span>
+ <span class="n">check_lg2</span><span class="p">(</span><span class="n"><a name="git_describe_workdir-4" class="fnlink" href="../../#v1.6.0/group/describe/git_describe_workdir">git_describe_workdir</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">describe_result</span><span class="p">,</span> <span class="n">repo</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">),</span>
+ <span class="s">&quot;Failed to describe workdir&quot;</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+
+ <span class="n">check_lg2</span><span class="p">(</span><span class="n"><a name="git_describe_format-5" class="fnlink" href="../../#v1.6.0/group/describe/git_describe_format">git_describe_format</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">buf</span><span class="p">,</span> <span class="n">describe_result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">),</span>
+ <span class="s">&quot;Failed to format describe rev&quot;</span><span class="p">,</span> <span class="n">rev</span><span class="p">);</span>
+
+ <span class="n">printf</span><span class="p">(</span><span class="s">&quot;%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">buf</span><span class="p">.</span><span class="n">ptr</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="k">static</span> <span class="kt">void</span> <span class="nf">do_describe</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="k">struct</span> <span class="n">describe_options</span> <span class="o">*</span><span class="n">opts</span><span class="p">)</span>
+<span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
+ <span class="n">do_describe_single</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+ <span class="k">else</span>
+ <span class="p">{</span>
+ <span class="kt">size_t</span> <span class="n">i</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">&lt;</span> <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
+ <span class="n">do_describe_single</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
+ <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="k">static</span> <span class="kt">void</span> <span class="nf">print_usage</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
+<span class="p">{</span>
+ <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;usage: see `git help describe`</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
+ <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
+<span class="p">}</span></pre></div>
+ </td>
+ </tr>
+ <tr id='section-4'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-4">&#182;</a>
+ </div>
+ <p>Parse command line arguments</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">parse_options</span><span class="p">(</span><span class="k">struct</span> <span class="n">describe_options</span> <span class="o">*</span><span class="n">opts</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="k">struct</span> <span class="n">args_info</span> <span class="n">args</span> <span class="o">=</span> <span class="n">ARGS_INFO_INIT</span><span class="p">;</span>
+
+ <span class="k">for</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">pos</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">args</span><span class="p">.</span><span class="n">pos</span> <span class="o">&lt;</span> <span class="n">argc</span><span class="p">;</span> <span class="o">++</span><span class="n">args</span><span class="p">.</span><span class="n">pos</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">curr</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="n">args</span><span class="p">.</span><span class="n">pos</span><span class="p">];</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="n">curr</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="sc">&#39;-&#39;</span><span class="p">)</span> <span class="p">{</span>
+ <span class="n">opts_add_commit</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">curr</span><span class="p">);</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--all&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">describe_strategy</span> <span class="o">=</span> <span class="n">GIT_DESCRIBE_ALL</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--tags&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">describe_strategy</span> <span class="o">=</span> <span class="n">GIT_DESCRIBE_TAGS</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--exact-match&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">max_candidates_tags</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--long&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">always_use_long_format</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--always&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">show_commit_oid_as_fallback</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">curr</span><span class="p">,</span> <span class="s">&quot;--first-parent&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">only_follow_first_parent</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">optional_str_arg</span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">dirty_suffix</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">args</span><span class="p">,</span> <span class="s">&quot;--dirty&quot;</span><span class="p">,</span> <span class="s">&quot;-dirty&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">match_int_arg</span><span class="p">((</span><span class="kt">int</span> <span class="o">*</span><span class="p">)</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">abbreviated_size</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">args</span><span class="p">,</span> <span class="s">&quot;--abbrev&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">match_int_arg</span><span class="p">((</span><span class="kt">int</span> <span class="o">*</span><span class="p">)</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">max_candidates_tags</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">args</span><span class="p">,</span> <span class="s">&quot;--candidates&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> <span class="p">{</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">match_str_arg</span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">.</span><span class="n">pattern</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">args</span><span class="p">,</span> <span class="s">&quot;--match&quot;</span><span class="p">))</span> <span class="p">{</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="n">print_usage</span><span class="p">();</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">dirty_suffix</span><span class="p">)</span>
+ <span class="n">fatal</span><span class="p">(</span><span class="s">&quot;--dirty is incompatible with commit-ishes&quot;</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="k">else</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">dirty_suffix</span> <span class="o">||</span> <span class="o">!</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">.</span><span class="n">dirty_suffix</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
+ <span class="n">opts_add_commit</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="s">&quot;HEAD&quot;</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+<span class="p">}</span></pre></div>
+ </td>
+ </tr>
+ <tr id='section-5'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-5">&#182;</a>
+ </div>
+ <p>Initialize describe_options struct</p>
+
+ </td>
+ <td class=code>
+ <div class='highlight'><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">describe_options_init</span><span class="p">(</span><span class="k">struct</span> <span class="n">describe_options</span> <span class="o">*</span><span class="n">opts</span><span class="p">)</span>
+<span class="p">{</span>
+ <span class="n">memset</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="o">*</span><span class="n">opts</span><span class="p">));</span>
+
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commits</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+ <span class="n">opts</span><span class="o">-&gt;</span><span class="n">commit_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="n"><a name="git_describe_options_init-1" class="fnlink" href="../../#v1.6.0/group/describe/git_describe_options_init">git_describe_options_init</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">describe_options</span><span class="p">,</span> <span class="n">GIT_DESCRIBE_OPTIONS_VERSION</span><span class="p">);</span>
+ <span class="n"><a name="git_describe_format_options_init-2" class="fnlink" href="../../#v1.6.0/group/describe/git_describe_format_options_init">git_describe_format_options_init</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="o">-&gt;</span><span class="n">format_options</span><span class="p">,</span> <span class="n">GIT_DESCRIBE_FORMAT_OPTIONS_VERSION</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="kt">int</span> <span class="nf">lg2_describe</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="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="k">struct</span> <span class="n">describe_options</span> <span class="n">opts</span><span class="p">;</span>
+
+ <span class="n">describe_options_init</span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="p">);</span>
+ <span class="n">parse_options</span><span class="p">(</span><span class="o">&amp;</span><span class="n">opts</span><span class="p">,</span> <span class="n">argc</span><span class="p">,</span> <span class="n">argv</span><span class="p">);</span>
+
+ <span class="n">do_describe</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">opts</span><span class="p">);</span>
+
+ <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span></pre></div>
+ </td>
+ </tr>
+ </table>
+</div>
+</body>