diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2023-06-05 20:05:55 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2023-06-18 12:21:19 +0200 |
commit | 1ccd5c4fa1cc4147464572b463876643e5672008 (patch) | |
tree | c2451a741430837f7f887e5cb9ebc9fe9395b9ba /create_all_tarballs | |
parent | 4eebab4010c5d61f58dacfae7d7bed752d4424d9 (diff) | |
download | scripts-1ccd5c4fa1cc4147464572b463876643e5672008.tar.gz scripts-1ccd5c4fa1cc4147464572b463876643e5672008.zip |
create_tarball: Add support for creating tarballs from head on a git tag.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'create_all_tarballs')
-rwxr-xr-x | create_all_tarballs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/create_all_tarballs b/create_all_tarballs index 1434f77..7caf7bd 100755 --- a/create_all_tarballs +++ b/create_all_tarballs @@ -70,12 +70,18 @@ cd `git rev-parse --show-toplevel` # Check remote branch branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` if [[ -z "$branch" ]]; then - branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch_detached=`git branch --contains HEAD | egrep "^\* \(HEAD detached at" | head -n1 | sed "s|^\* (HEAD detached at \([^)]*\)).*$|\1|"` + branch=`git tag | grep -Fx "${branch_detached}"` +fi +if [[ -z "$branch" ]]; then + branch=`git branch -r --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch=${branch#origin/} fi if [[ -z "$branch" ]] || - [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then - echo "There is not active upstream branch. Exiting..." - exit 1 + ( [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]] && + [[ -z "`git tag | grep -Fx \"${branch}\"`" ]] ); then + echo "There is not active upstream branch. Exiting." + exit 1 fi # Set target version @@ -106,12 +112,18 @@ if [ "$TARGET" != "${TARGET#3.5.}" ]; then else targetBranch=master fi + if [ "$branch" = "v${TARGET}" ]; then + targetBranch=v${TARGET} + fi else if [ "$TARGET" != "${TARGET%.0}" ]; then targetBranch=master else targetBranch=r${TARGET%.*}.x fi + if [ "$branch" = "r${TARGET}" ]; then + targetBranch=r${TARGET} + fi fi if [ "$branch" != "$targetBranch" ]; then echo "Target $TARGET is not valid on $branch branch. Exiting." |