ostree_repo_resolve_rev: Resolve refs set in the transaction

This allows you to get at the current commit for a ref pending in the transaction.

Closes: #1624
Approved by: cgwalters
This commit is contained in:
Alexander Larsson 2018-06-13 19:20:28 +02:00 committed by Atomic Bot
parent 2d2f218669
commit 677e181025
1 changed files with 22 additions and 1 deletions

View File

@ -245,7 +245,28 @@ resolve_refspec (OstreeRepo *self,
{
ret_rev = g_strdup (ref);
}
else if (remote != NULL)
else if (self->in_transaction)
{
const char *refspec;
if (remote != NULL)
refspec = glnx_strjoina (remote, ":", ref);
else
refspec = ref;
g_mutex_lock (&self->txn_lock);
if (self->txn.refs)
ret_rev = g_strdup (g_hash_table_lookup (self->txn.refs, refspec));
g_mutex_unlock (&self->txn_lock);
}
if (ret_rev != NULL)
{
ot_transfer_out_value (out_rev, &ret_rev);
return TRUE;
}
if (remote != NULL)
{
const char *remote_ref = glnx_strjoina ("refs/remotes/", remote, "/", ref);