Forums » Software Development »
oe-layertool-setup.sh script seems to pull and merge when it shouldn't need to
Added by Nathan Wright 5 months ago
We noticed in our pipeline setup that the oe-layertool-setup.sh script still appeared to be pulling and merging against a cached repo that had no changes. We are on ubuntu 24.
We think this fixes it...
diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index 2bee538..799f984 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh@ -460,7 +460,7
@ checkout_branch() {
# Check if a local branch already exists to track the remote branch.
# If not then create a tracking branch and checkout the branch
# else just checkout the existing branch
- if git branch | grep -q "$branch"
+ if ! git branch | grep -q "$branch"
then
git checkout "origin/$branch" -b "$branch" --track
else
Replies (3)
RE: oe-layertool-setup.sh script seems to pull and merge when it shouldn't need to - Added by Nathan Wright 5 months ago
while we're at it, why let it complain about detached heads when the config file asked for detached heads?
diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index 2bee538..ffd57ca 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh
@@ -460,11 +460,11 @@ checkout_branch() {
# Check if a local branch already exists to track the remote branch.
# If not then create a tracking branch and checkout the branch
# else just checkout the existing branch
- if git branch | grep -q "$branch"
+ if ! git branch | grep -q "$branch"
then
- git checkout "origin/$branch" -b "$branch" --track
+ git -c advice.detachedHead=false checkout "origin/$branch" -b "$branch" --track
else
- git checkout "$branch"
+ git -c advice.detachedHead=false checkout "$branch"
fi
# Now that we are on the proper branch pull the remote branch changes if
@@ -484,7 +484,7 @@ checkout_commit() {
cd "$sourcedir/$name" || return 1
if [ "$commit" != "HEAD" ]
then
- git checkout $commit
+ git -c advice.detachedHead=false checkout $commit
fi
}
RE: oe-layertool-setup.sh script seems to pull and merge when it shouldn't need to - Added by Jonathan Cormier 5 months ago
I think both of these make a lot of sense. I'd recommend reporting this to TI via the meta-arago mailing list. They should even include your name as the patch author.
Here is the last patch submitted related to the oe-layertool-setup.sh script as a template.
https://lists.yoctoproject.org/g/meta-arago/message/15338
Incase you are unfamiliar, git does have a send-email subcommand that is designed to help with sending patches to mailing lists like this. Unfortunately, it takes a bit to setup but if you're interested. https://stackoverflow.com/a/68238913/780194
RE: oe-layertool-setup.sh script seems to pull and merge when it shouldn't need to - Added by Nathan Wright 5 months ago
Ok, I did.