From: David Reyna <[email protected]>

The HEAD reference in Toaster layers are reserved for the
"Local Yocto Project" layers, stored at the top directory.
Imported layers are not allowed to use this since they are
managed differently - for example the 'remotes' will collide.

[YOCTO #9924]

Signed-off-by: David Reyna <[email protected]>
---
 bitbake/lib/toaster/toastergui/static/js/importlayer.js   | 15 ++++++++++++---
 bitbake/lib/toaster/toastergui/templates/importlayer.html |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js 
b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index b3f094e..f351751 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -244,9 +244,18 @@ function importLayerPageInit (ctx) {
         enable_import_btn(true);
       }
 
-      if ($("#git-repo-radio").prop("checked") &&
-          vcsURLInput.val().length > 0 && gitRefInput.val().length > 0) {
-        enable_import_btn(true);
+      if ($("#git-repo-radio").prop("checked")) {
+        if (gitRefInput.val().length > 0 &&
+            gitRefInput.val() == 'HEAD') {
+          $('#invalid-layer-revision-hint').show();
+          $('#layer-revision-ctrl').addClass('has-error');
+          enable_import_btn(false);
+        } else if (vcsURLInput.val().length > 0 && 
+                   gitRefInput.val().length > 0) {
+          $('#invalid-layer-revision-hint').hide();
+          $('#layer-revision-ctrl').removeClass('has-error');
+          enable_import_btn(true);
+        }
       }
     }
 
diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html 
b/bitbake/lib/toaster/toastergui/templates/importlayer.html
index afbeb94..7e5253e 100644
--- a/bitbake/lib/toaster/toastergui/templates/importlayer.html
+++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html
@@ -115,8 +115,8 @@
         </label>
         <span style="display: block">
         <input type="text" class="form-control" id="layer-git-ref" 
autocomplete="off" data-minLength="1" data-autocomplete="off" 
data-provide="typeahead" required>
-        <span class="help-inline" style="display:none;" 
id="invalid-layer-revision-hint"></span>
         </span>
+        <span class="help-block has-error" style="display:none;" 
id="invalid-layer-revision-hint">The "HEAD" branch is reserved (only allowed 
for the "Local Yocto Project" layers)</span>
       </div>
     </fieldset>
 
-- 
1.9.1

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to