[gnome-ostree] build: Fix up case where we have no previous build for a component
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] build: Fix up case where we have no previous build for a component
- Date: Tue, 10 Sep 2013 22:40:22 +0000 (UTC)
commit b605108a965039aa4935986daa34cda36c0517bb
Author: Colin Walters <walters verbum org>
Date: Tue Sep 10 18:33:39 2013 -0400
build: Fix up case where we have no previous build for a component
There is no parent. While we're here, let's change things so that we
always give null for a parent to commit.
src/js/tasks/task-build.js | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/js/tasks/task-build.js b/src/js/tasks/task-build.js
index 3cd7a8b..de96aba 100644
--- a/src/js/tasks/task-build.js
+++ b/src/js/tasks/task-build.js
@@ -519,14 +519,19 @@ const TaskBuild = new Lang.Class({
return file;
},
- _commit: function(branch, subject, file, cancellable) {
+ _commit: function(branch, subject, file, cancellable, params) {
+ params = Params.parse(params, { withParent: true });
let [, parentRev] = this.ostreeRepo.resolve_rev(branch, true);
- let [, parent] = this.ostreeRepo.read_commit(parentRev, cancellable);
-
- let changed = !file.equal(parent);
+ let changed;
+ if (parentRev) {
+ let [, parent] = this.ostreeRepo.read_commit(parentRev, cancellable);
+ changed = !file.equal(parent);
+ } else {
+ changed = true;
+ }
if (changed) {
- let [, rev] = this.ostreeRepo.write_commit(parentRev, subject, "", null, file, cancellable);
+ let [, rev] = this.ostreeRepo.write_commit(params.withParent ? parentRev : null, subject, "",
null, file, cancellable);
this.ostreeRepo.transaction_set_ref(null, branch, rev);
return rev;
} else {
@@ -701,7 +706,7 @@ const TaskBuild = new Lang.Class({
this.ostreeRepo.prepare_transaction(cancellable);
let file = this._writeMtreeFromDirectory(finalBuildResultDir, setuidFiles, cancellable);
- let rev = this._commit(buildRef, "Build", file, cancellable);
+ let rev = this._commit(buildRef, "Build", file, cancellable, { withParent: false });
this.ostreeRepo.commit_transaction(cancellable);
let ostreeRevision = this._saveComponentBuild(buildRef, rev, expandedComponent, cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]