core: Allow / in ref names like git does

Using / is nice basically.
This commit is contained in:
Colin Walters committed 2011-12-22 15:59:47 -05:00
1 parent a47556432b
commit 3292dcb6d6
3 files changed
+91 -50

No files matched your search

+18 -1
View File
@@ -32,12 +32,29 @@ gboolean
ostree_validate_checksum_string (const char *sha256,
GError **error)
{
if (strlen (sha256) != 64)
int i = 0;
size_t len = strlen (sha256);
if (len != 64)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid rev '%s'", sha256);
return FALSE;
}
for (i = 0; i < len; i++)
{
guint8 c = ((guint8*) sha256)[i];
if (!((c >= 48 && c <= 57)
|| (c >= 97 && c <= 102)))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid character '%d' in rev '%s'",
c, sha256);
return FALSE;
}
}
return TRUE;
}