cli/rev-parse: Add --single option

In the current "ostree native container" flow, we're inserting
a commit object into the repo but with no refs.

We have hacks in a few places to find the commit digest via e.g.
`find repo/objects -name *.commit` but that's a horrible hack.
Add `ostree rev-parse --single` which will print the single commit,
and error out if there is not exactly one commit.

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
This commit is contained in:
Colin WaltersandJonathan Lebon committed 2022-08-18 11:08:17 -04:00
1 parent ea2f0c2943
commit ad0354ac36
3 files changed
+66 -1

No files matched your search

+13
View File
@@ -54,6 +54,19 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</refsynopsisdiv>
<refsect1>
<title>Options</title>
<variablelist>
<varlistentry>
<term><option>--single</option>, <option>-S</option></term>
<listitem><para>
If the repository has exactly one commit, then print it; any other case will result in an error.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<!-- Is this accurate for all cases? This is what I observed -->
<refsect1>
<title>Description</title>