cache: Make sure we escape stage names when we mark them as done

We need to to this, because they are also escaped as refs in the cache.

Fixes https://github.com/flatpak/flatpak-builder/issues/214

Closes: #215
Approved by: alexlarsson
auto
Alexander Larsson 2018-09-21 09:22:31 +02:00 committed by Atomic Bot
parent 5bb3e5801b
commit 05dd2c68d9
1 changed files with 16 additions and 7 deletions

View File

@ -210,13 +210,10 @@ builder_cache_get_checksum (BuilderCache *self)
return self->checksum;
}
static char *
get_ref (BuilderCache *self, const char *stage)
static void
append_escaped_stage (GString *s,
const char *stage)
{
GString *s = g_string_new (self->branch);
g_string_append_c (s, '/');
while (*stage)
{
char c = *stage++;
@ -228,6 +225,16 @@ get_ref (BuilderCache *self, const char *stage)
else
g_string_append_printf (s, "%x", c);
}
}
static char *
get_ref (BuilderCache *self, const char *stage)
{
GString *s = g_string_new (self->branch);
g_string_append_c (s, '/');
append_escaped_stage (s, stage);
return g_string_free (s, FALSE);
}
@ -376,11 +383,13 @@ builder_cache_lookup (BuilderCache *self,
{
g_autofree char *commit = NULL;
g_autofree char *ref = NULL;
g_autoptr(GString) s = g_string_new ("");
g_free (self->stage);
self->stage = g_strdup (stage);
g_hash_table_remove (self->unused_stages, stage);
append_escaped_stage (s, stage);
g_hash_table_remove (self->unused_stages, s->str);
g_free (self->current_checksum);
self->current_checksum = g_strdup (g_checksum_get_string (self->checksum));