Skip to content

Commit 67d98b1

Browse files
INSTALL: using porcelain to detect if the clone is up-to-date (no risk of locale or rebase strategy impacting the result)
1 parent 5a5a950 commit 67d98b1

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

install.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ if [ $upgrade -eq 1 -a $makerfaire2018 -eq 0 -a -d ${home_dir}/wm8960 ]; then
7676
echo "Updating sound driver - 2/14" > /tmp/pynab.upgrade
7777
cd ${home_dir}/wm8960
7878
sudo chown -R ${owner} .git
79-
# Making sure we keep the up-to-date status message consistent no matter the rebase default behavior
80-
pull=$(LANGUAGE=en git pull --no-rebase)
81-
if [ "$pull" != "Already up to date." ]; then
79+
# First we want to be sure we know everything from the remote branch status
80+
git fetch
81+
# Then we can check if the status considers our clone behind the remote (or not)
82+
if git status --branch --porcelain | grep -q "\[behind"; then
83+
git pull # Making sure we update the clone to the latest before rebuilding
8284
make && sudo make install && make clean
8385
sudo touch /tmp/pynab.upgrade.reboot
8486
fi
@@ -89,9 +91,11 @@ if [ $upgrade -eq 1 ]; then
8991
if [ -d ${home_dir}/tagtagtag-ears ]; then
9092
cd ${home_dir}/tagtagtag-ears
9193
sudo chown -R ${owner} .git
92-
# Making sure we keep the up-to-date status message consistent no matter the rebase default behavior
93-
pull=$(LANGUAGE=en git pull --no-rebase)
94-
if [ "$pull" != "Already up to date." ]; then
94+
# First we want to be sure we know everything from the remote branch status
95+
git fetch
96+
# Then we can check if the status considers our clone behind the remote (or not)
97+
if git status --branch --porcelain | grep -q "\[behind"; then
98+
git pull # Making sure we update the clone to the latest before rebuilding
9599
make && sudo make install && make clean
96100
sudo touch /tmp/pynab.upgrade.reboot
97101
fi
@@ -114,9 +118,11 @@ if [ $upgrade -eq 1 ]; then
114118
if [ -d ${home_dir}/cr14 ]; then
115119
cd ${home_dir}/cr14
116120
sudo chown -R ${owner} .git
117-
# Making sure we keep the up-to-date status message consistent no matter the rebase default behavior
118-
pull=$(LANGUAGE=en git pull --no-rebase)
119-
if [ "$pull" != "Already up to date." ]; then
121+
# First we want to be sure we know everything from the remote branch status
122+
git fetch
123+
# Then we can check if the status considers our clone behind the remote (or not)
124+
if git status --branch --porcelain | grep -q "\[behind"; then
125+
git pull # Making sure we update the clone to the latest before rebuilding
120126
make && sudo make install && make clean
121127
sudo touch /tmp/pynab.upgrade.reboot
122128
fi
@@ -139,9 +145,11 @@ if [ $upgrade -eq 1 ]; then
139145
if [ -d ${root_dir}/nabblockly ]; then
140146
cd ${root_dir}/nabblockly
141147
sudo chown -R ${owner} .
142-
# Making sure we keep the up-to-date status message consistent no matter the rebase default behavior
143-
pull=$(LANGUAGE=en git pull --no-rebase)
144-
if [ "$pull" != "Already up to date." ]; then
148+
# First we want to be sure we know everything from the remote branch status
149+
git fetch
150+
# Then we can check if the status considers our clone behind the remote (or not)
151+
if git status --branch --porcelain | grep -q "\[behind"; then
152+
git pull # Making sure we update the clone to the latest before rebuilding
145153
./rebar3 release
146154
fi
147155
else

0 commit comments

Comments
 (0)