[gnome-continuous] vcs: Fix previous commit to make tarball imports work again



commit c0ab74e0870d6e06a75db90713b097a2ed7e5f12
Author: Colin Walters <walters verbum org>
Date:   Sat Jan 11 09:09:02 2014 -0500

    vcs: Fix previous commit to make tarball imports work again
    
    rev-parse may need to be able to fail.

 src/js/vcs.js |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/js/vcs.js b/src/js/vcs.js
index 49a814d..67fc010 100644
--- a/src/js/vcs.js
+++ b/src/js/vcs.js
@@ -232,10 +232,17 @@ function ensureVcsMirror(mirrordir, component, cancellable,
     }
 }
 
-function revParse(dirpath, branch, cancellable) {
-    let args = ['git', 'rev-parse', branch]
-    return ProcUtil.runSyncGetOutputUTF8(args, cancellable,
-                                        {cwd: dirpath}).replace(/[ \n]/g, '');
+function revParse(dirpath, branch, cancellable, params) {
+    params = Params.parse(params, { allowNone: false });
+    let args = ['git', 'rev-parse', branch];
+    let res;
+    if (params.allowNone)
+       res = ProcUtil.runSyncGetOutputUTF8StrippedOrNull(args, cancellable, { cwd: dirpath });
+    else
+       res = ProcUtil.runSyncGetOutputUTF8(args, cancellable, { cwd: dirpath });
+    if (res === null)
+       return res;
+    return res.replace(/[ \n]/g, '');
 }
 
 function _ensureVcsMirrorGit(mirrordir, uri, branch, cancellable, params) {
@@ -321,7 +328,7 @@ function _ensureVcsMirrorTarball(mirrordir, name, uri, checksum, cancellable, pa
     }
     
     let importTag = 'tarball-import-' + checksum;
-    let gitRevision = revParse(mirror, importTag, cancellable);
+    let gitRevision = revParse(mirror, importTag, cancellable, { allowNone: true });
     if (gitRevision != null) {
        return mirror;
     }  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]