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.
This commit is contained in:
Colin Walters 2012-02-24 16:08:34 -05:00
parent a90e091037
commit 51916a7002
2 changed files with 16 additions and 11 deletions

View File

@ -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);
}
}

View File

@ -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);