From 51916a700236415f5150513bb637cb7cd72bc314 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 24 Feb 2012 16:08:34 -0500 Subject: [PATCH] core: Look up refs like origin/foo correctly again We want to support both "bare" lookups where "foo" can be local, or in any remote, as well as prefixed ones for a specific remote. This fixes ostree-pull noticing that nothing has changed. --- src/libostree/ostree-repo.c | 25 ++++++++++++++++--------- src/ostree/ostree-pull.c | 2 -- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 67057d52..17f3c7b4 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -384,19 +384,26 @@ ostree_repo_resolve_rev (OstreeRepo *self, { g_clear_object (&child); - if (!find_rev_in_remotes (self, rev, &child, error)) - goto out; + child = g_file_resolve_relative_path (priv->remote_heads_dir, rev); - if (child == NULL) + if (!g_file_query_exists (child, NULL)) { - if (!allow_noent) + g_clear_object (&child); + + if (!find_rev_in_remotes (self, rev, &child, error)) + goto out; + + if (child == NULL) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Rev '%s' not found", rev); - goto out; + if (!allow_noent) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Rev '%s' not found", rev); + goto out; + } + else + g_clear_object (&child); } - else - g_clear_object (&child); } } diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c index c088cb53..3b929435 100644 --- a/src/ostree/ostree-pull.c +++ b/src/ostree/ostree-pull.c @@ -463,7 +463,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) OstreeRepo *repo = NULL; const char *remote; const char *branch; - char *remote_branch_ref_path = NULL; char *key = NULL; char *baseurl = NULL; char *refpath = NULL; @@ -566,7 +565,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) g_free (original_rev); g_free (baseurl); g_free (refpath); - g_free (remote_branch_ref_path); g_clear_object (&soup); if (base_uri) soup_uri_free (base_uri);