Skip to content

Commit

Permalink
androdeb: make repository URL detection more robust
Browse files Browse the repository at this point in the history
The previous logic to detect the git repository URL was prone to failure
when git version changed. Changed it to rely on git config and use the first
remote found

Signed-off-by: Erick Reyes <[email protected]>
  • Loading branch information
ErickReyesR committed Aug 21, 2018
1 parent 2236740 commit ab56927
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions androdeb
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,7 @@ function all_done_banner() {
}

function detect_repo_url() {
GIT_REMOTE=`cd $spath && git branch -vv | grep "\*" | sed -e "s/.*\[//" | cut -d "/" -f 1`
if [ -z $GIT_REMOTE ]; then
c_warning "Not running from a git repository, unable to determine URL"
return 0
fi
ADEB_REPO_URL=`cd $spath && git remote show $GIT_REMOTE | grep "Fetch URL" | sed -e "s/.*Fetch URL://" \
ADEB_REPO_URL=`cd $spath && git config -l | grep -m1 remote | grep url | sed -e "s/.*url=//" \
-e "s/.*@//" \
-e "s/https:\/\///" \
-e "s/:/\//" \
Expand Down

0 comments on commit ab56927

Please sign in to comment.