Skip to content

Commit 06280b2

Browse files
Merge pull request #43 from ThatMG393/experimental
fix 115adf5
2 parents c3ab243 + 29590c9 commit 06280b2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

udroid/src/udroid.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ update_cache() {
10941094
# To upgrade tool with git
10951095
# by maintaining a local cache
10961096
_upgrade() {
1097-
1097+
TITLE "upgrade()"
10981098
local branch=""
10991099

11001100
while [ $# -gt 0 ]; do
@@ -1129,6 +1129,17 @@ _upgrade() {
11291129
LOG "upgrade(): switching to branch $branch"
11301130
git -C $repo_cache checkout $branch
11311131
fi
1132+
1133+
new_commits=$(git -C $repo_cache --no-pager log --oneline HEAD..origin)
1134+
if [[ -z $new_commits ]]; then
1135+
LOG "upgrade(): already in the lastest version, no need to upgrade"
1136+
DIE "Already up to date!"
1137+
fi
1138+
1139+
echo "---- new commits ----"
1140+
git -C $repo_cache --no-pager log --oneline HEAD..origin # $new_commits is not formatted
1141+
echo -e "---------------------\n"
1142+
sleep .5
11321143

11331144
# pull latest changes, if conflict occurs, clean and pull again
11341145
git -C $repo_cache pull || {
@@ -1137,11 +1148,6 @@ _upgrade() {
11371148
git -C $repo_cache pull
11381149
}
11391150

1140-
echo "----"
1141-
git --no-pager log --oneline HEAD..origin
1142-
echo -e "----\n"
1143-
sleep 1
1144-
11451151
# change to repo directory and install it
11461152
cd $repo_cache || {
11471153
ELOG "upgrade(): failed to change to $repo_cache"

0 commit comments

Comments
 (0)