repo: Update HEAD after a commit
This commit is contained in:
parent
9cac933c7f
commit
72c7385295
|
|
@ -193,6 +193,10 @@ parse_checksum_file (HacktreeRepo *self,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_strchomp (ret_sha256);
|
||||||
|
}
|
||||||
|
|
||||||
*sha256 = ret_sha256;
|
*sha256 = ret_sha256;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
@ -200,6 +204,25 @@ parse_checksum_file (HacktreeRepo *self,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
write_checksum_file (const char *path,
|
||||||
|
const char *sha256,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
char *buf = NULL;
|
||||||
|
|
||||||
|
buf = g_strconcat (sha256, "\n", NULL);
|
||||||
|
|
||||||
|
if (!g_file_set_contents (path, buf, -1, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
out:
|
||||||
|
g_free (buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
hacktree_repo_check (HacktreeRepo *self, GError **error)
|
hacktree_repo_check (HacktreeRepo *self, GError **error)
|
||||||
{
|
{
|
||||||
|
|
@ -1207,6 +1230,12 @@ hacktree_repo_commit (HacktreeRepo *self,
|
||||||
commit, &ret_commit_checksum, error))
|
commit, &ret_commit_checksum, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (!write_checksum_file (priv->head_ref_path, g_checksum_get_string (ret_commit_checksum), error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
g_free (priv->current_head);
|
||||||
|
priv->current_head = g_strdup (g_checksum_get_string (ret_commit_checksum));
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
out:
|
out:
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue