summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Reyes <erickreyes@google.com>2018-08-17 16:02:00 -0700
committerErick Reyes <erickreyes@google.com>2018-08-20 17:04:04 -0700
commitab56927bf163cbd728b06161dd335da608369c6e (patch)
tree5eae890142c8041c9b54d1a263cff2a4f8ed8306
parent223674023a4a0024e3477c8e5ca69aac77fe98b5 (diff)
downloadadeb-ab56927bf163cbd728b06161dd335da608369c6e.tar.gz
androdeb: make repository URL detection more robust
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 <erickreyes@google.com>
-rwxr-xr-xandrodeb7
1 files changed, 1 insertions, 6 deletions
diff --git a/androdeb b/androdeb
index 9456d60..ee898fb 100755
--- a/androdeb
+++ b/androdeb
@@ -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/:/\//" \