travis-ci: fix "skip_branch_tip_with_tag()" string comparison
PATCH 1/1 travis-ci: fix "skip_branch_tip_with_tag()" string comparison
From: Lars Schneider <[email protected]>
09f5e97 ("travis-ci: skip a branch build if equal tag is present", 2017-09-17) introduced the "skip_branch_tip_with_tag" function with a broken string comparison. Fix it!
---
Hi,
previous discussion:
https://public-inbox.org/git/[email protected]/
Sorry that this trivial fix took so long.
Cheers,
Lars
Notes:
Base Commit: a81423d7cf (a81423d7cfdc57238783f05394dddd1064c99165)
Diff on Web: https://github.com/larsxschneider/git/commit/6b532a42f0
Checkout: git fetch https://github.com/larsxschneider/git travisci/fix-skip-branch-v1 && git checkout 6b532a42f0ci/lib-travisci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ci/lib-travisci.sh +1 -1
@@ -14,7 +14,7 @@ skip_branch_tip_with_tag () { # of a tag. if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) && - $TAG != $TRAVIS_BRANCH + [ "$TAG" != "$TRAVIS_BRANCH" ] then echo "Tip of $TRAVIS_BRANCH is exactly at $TAG" exit 0
--
2.14.1
Quoted 7 lines · [email protected] wrote:
09f5e97 ("travis-ci: skip a branch build if equal tag is present", 2017-09-17) introduced the "
skip_branch_tip_with_tag" function with a broken string comparison. Fix it!Reported-by SZEDER Gábor <[email protected]>Signed-off-by Lars Schneider <[email protected]>---
Thanks for the fix.
09f5e97 appears to be for the ls/travis-scriptify branch, which is already part of "next" (if it weren't, I'd suggest just squashing your patch into that commit).
ci/lib-travisci.sh skip_branch_tip_with_tag () { · line 17
Quoted 8 lines
ci/lib-travisci.sh +1
-1@@ -14,7 +14,7 @@ skip_branch_tip_with_tag () { # of a tag. if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) && - $TAG != $TRAVIS_BRANCH + [ "$TAG" != "$TRAVIS_BRANCH" ]
Git style is to use 'test' instead of '[' for this. See
https://public-inbox.org/git/[email protected]/
for more on that subject.
Could you squash in the following?
Thanks,
Jonathan
ci/lib-travisci.sh +1 -1
@@ -14,7 +14,7 @@ skip_branch_tip_with_tag () { # of a tag. if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) && - [ "$TAG" != "$TRAVIS_BRANCH" ] + test "$TAG" != "$TRAVIS_BRANCH" then echo "Tip of $TRAVIS_BRANCH is exactly at $TAG" exit 0
Quoted 24 lines · Jonathan Nieder
Quoted 7 lines · [email protected] wrote:
09f5e97 ("travis-ci: skip a branch build if equal tag is present", 2017-09-17) introduced the "
skip_branch_tip_with_tag" function with a broken string comparison. Fix it!Reported-by SZEDER Gábor <[email protected]>Signed-off-by Lars Schneider <[email protected]>---
Thanks for the fix.
09f5e97 appears to be for the ls/travis-scriptify branch, which is already part of "next" (if it weren't, I'd suggest just squashing your patch into that commit).
Quoted 5 lines
ci/lib-travisci.sh +0
-0@@ -14,7 +14,7 @@ skip_branch_tip_with_tag () { # of a tag.
Quoted 7 lines
ci/lib-travisci.sh skip_branch_tip_with_tag () { · line 17
Quoted 3 lines
ci/lib-travisci.sh +1
-1if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) && - $TAG != $TRAVIS_BRANCH + [ "$TAG" != "$TRAVIS_BRANCH" ]Git style is to use 'test' instead of '[' for this. See
https://public-inbox.org/git/[email protected]/
for more on that subject.
Oh, you're right!
Quoted 1 line
Could you squash in the following?
@Junio: Can you squash it when you apply the patch?
Thank you,
Lars
Quoted 17 lines
Thanks,
Jonathanci/lib-travisci.sh +1
-1@@ -14,7 +14,7 @@ skip_branch_tip_with_tag () { # of a tag. if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) && - [ "$TAG" != "$TRAVIS_BRANCH" ] + test "$TAG" != "$TRAVIS_BRANCH" then echo "Tip of $TRAVIS_BRANCH is exactly at $TAG" exit 0
Quoted 6 lines · Lars Schneider
Oh, you're right!
Quoted 1 line
Could you squash in the following?
@Junio: Can you squash it when you apply the patch?
I do not mind and I already did.
The patches in the series this patch is fixing up were solely about splitting these scripts out of the YAML file as-is, and I think it was correct to carry these style differences over without adjusting them.
But resulting scripts in ci/ are riddled with styleguide deviations, which may want to be cleaned up later. There also are some bash-isms marked with "#!env bash" in them, but I think they are OK because we know we are running them only at a very specific place and the need to make them portable is very small.
Thanks.