Skip to content

Commit

Permalink
Modify get_parent_branch_name to extract info from git remote show or…
Browse files Browse the repository at this point in the history
…igin
  • Loading branch information
ahmad-el-sayed committed Oct 9, 2024
1 parent ecdc037 commit ef0c43e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions scripts/manage_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,20 @@ function get_default_branch_name() {

function get_parent_branch_name() {
local repo_path="$1"
git -C ${repo_path} fetch --depth=10000
git -C ${repo_path} fetch --all
# git -C ${repo_path} fetch --depth=10000
# git -C ${repo_path} fetch --all
# echo $(
# git -C ${repo_path} show-branch |
# grep '\*' |
# grep -v $(git -C "${repo_path}" rev-parse --abbrev-ref HEAD) |
# head -n1 |
# sed 's/.*\[//g' | sed 's/\].*//g'
# )

echo $(
git -C ${repo_path} show-branch |
grep '\*' |
grep -v $(git -C "${repo_path}" rev-parse --abbrev-ref HEAD) |
head -n1 |
sed 's/.*\[//g' | sed 's/\].*//g'
git -C ${repo_path} remote show origin |
grep " HEAD branch: " |
sed 's@^ HEAD branch: @@'
)
}

Expand Down

0 comments on commit ef0c43e

Please sign in to comment.