Skip to content

Commit

Permalink
Merge pull request #43 from ThatMG393/experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
SaicharanKandukuri authored Jun 4, 2023
2 parents c3ab243 + 29590c9 commit 06280b2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions udroid/src/udroid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ update_cache() {
# To upgrade tool with git
# by maintaining a local cache
_upgrade() {

TITLE "upgrade()"
local branch=""

while [ $# -gt 0 ]; do
Expand Down Expand Up @@ -1129,6 +1129,17 @@ _upgrade() {
LOG "upgrade(): switching to branch $branch"
git -C $repo_cache checkout $branch
fi

new_commits=$(git -C $repo_cache --no-pager log --oneline HEAD..origin)
if [[ -z $new_commits ]]; then
LOG "upgrade(): already in the lastest version, no need to upgrade"
DIE "Already up to date!"
fi

echo "---- new commits ----"
git -C $repo_cache --no-pager log --oneline HEAD..origin # $new_commits is not formatted
echo -e "---------------------\n"
sleep .5

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

echo "----"
git --no-pager log --oneline HEAD..origin
echo -e "----\n"
sleep 1

# change to repo directory and install it
cd $repo_cache || {
ELOG "upgrade(): failed to change to $repo_cache"
Expand Down

0 comments on commit 06280b2

Please sign in to comment.