summaryrefslogtreecommitdiff
path: root/builder/builder-source-git.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-12-09 14:26:41 +0100
committerAlexander Larsson <alexl@redhat.com>2015-12-09 14:26:41 +0100
commitb716e0d8eba438b396049453d1b8c48cb5da6b75 (patch)
treeb07eee913a93786d8ee4586a8839a21ec32400ef /builder/builder-source-git.c
parentdfc11d5e87440b3b658d8014a154bfccfb0100d7 (diff)
downloadxdg-app-b716e0d8eba438b396049453d1b8c48cb5da6b75.tar.gz
Builder: Add a resolved version of the manifest to the built app
Diffstat (limited to 'builder/builder-source-git.c')
-rw-r--r--builder/builder-source-git.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/builder/builder-source-git.c b/builder/builder-source-git.c
index 37cc217..8c69d6d 100644
--- a/builder/builder-source-git.c
+++ b/builder/builder-source-git.c
@@ -518,6 +518,33 @@ builder_source_git_checksum (BuilderSource *source,
g_warning ("No url");
}
+static gboolean
+builder_source_git_update (BuilderSource *source,
+ BuilderContext *context,
+ GError **error)
+{
+ BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
+ g_autoptr(GFile) mirror_dir = NULL;
+ char *current_commit;
+ g_autofree char *url = NULL;
+
+ url = get_url (self, context, error);
+ if (url == NULL)
+ return FALSE;
+
+ mirror_dir = git_get_mirror_dir (url, context);
+
+ current_commit = git_get_current_commit (mirror_dir, get_branch (self), context, NULL);
+ g_print ("current commit %s\n", current_commit);
+ if (current_commit)
+ {
+ g_free (self->branch);
+ self->branch = current_commit;
+ }
+
+ return TRUE;
+}
+
static void
builder_source_git_class_init (BuilderSourceGitClass *klass)
{
@@ -530,6 +557,7 @@ builder_source_git_class_init (BuilderSourceGitClass *klass)
source_class->download = builder_source_git_download;
source_class->extract = builder_source_git_extract;
+ source_class->update = builder_source_git_update;
source_class->checksum = builder_source_git_checksum;
g_object_class_install_property (object_class,