Blob Blame History Raw
From 47ba21aca15be084deda0f9d80336ce0cb2717cc Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jlebon@redhat.com>
Date: Mon, 31 Oct 2016 12:19:08 -0400
Subject: [PATCH] daemon: use refspec after pulling ancestry

Previously, in preparation for validating e.g. versions during 'deploy'
operations, we would pull the latest commit metadata. However, we would
then do resolve on the branch name only rather than the full refspec.
But this can sometimes give the wrong checksum. For example, if we have
multiple remotes holding the same branch name, ostree_repo_resolve_rev
will just start looking in each remote for the specified ref, and we may
thus end up with the checksum from the wrong remote.

Related: RHBZ#1390259

Closes: #507
Approved by: cgwalters
---
 src/daemon/rpmostreed-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/daemon/rpmostreed-utils.c b/src/daemon/rpmostreed-utils.c
index d0f0abb..2f3aa5c 100644
--- a/src/daemon/rpmostreed-utils.c
+++ b/src/daemon/rpmostreed-utils.c
@@ -301,7 +301,7 @@ rpmostreed_repo_pull_ancestry (OstreeRepo               *repo,
       /* First pass only.  Now we can resolve the ref to a checksum. */
       if (checksum == NULL)
         {
-          if (!ostree_repo_resolve_rev (repo, ref, FALSE, &checksum, error))
+          if (!ostree_repo_resolve_rev (repo, refspec, FALSE, &checksum, error))
             goto out;
         }
 
-- 
2.7.4