Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: fix revision calculation using new "main" branch #15538

Merged
merged 1 commit into from
May 21, 2024

Conversation

M95D
Copy link
Contributor

@M95D M95D commented May 21, 2024

Fixes revision calculation when local branch is rebased on "main" instead of "master".
https://forum.openwrt.org/t/release-version-appears-as-r0-26304/198446

@github-actions github-actions bot added the build/scripts/tools pull request/issues for build, scripts and tools related changes label May 21, 2024
Copy link
Member

@KanjiMonster KanjiMonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@rany2
Copy link
Contributor

rany2 commented May 21, 2024

Why not just use the ${BRANCH} variable? Nevermind, looks good.

@M95D
Copy link
Contributor Author

M95D commented May 21, 2024

Because the branch may be other than "main", in which case the revision looks like r26281+22-0162174e7e, where 26281 is the main branch and +22 are local commits on the local branch.

Copy link
Member

@KanjiMonster KanjiMonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a signed-off-by though, and the PR description should be in the commit as well.

@M95D
Copy link
Contributor Author

M95D commented May 21, 2024

Right! I always forget that. :-|

@rany2
Copy link
Contributor

rany2 commented May 21, 2024

@M95D Off topic but I just use this hook:

touch .git/hooks/prepare-commit-msg
chmod +x .git/hooks/prepare-commit-msg

Then paste the following into the file:

#!/bin/sh

NAME=$(git config user.name)
EMAIL=$(git config user.email)

if [ -z "$NAME" ]; then
    echo "empty git config user.name"
    exit 1
fi

if [ -z "$EMAIL" ]; then
    echo "empty git config user.email"
    exit 1
fi

git interpret-trailers --if-exists doNothing --trailer \
    "Signed-off-by: $NAME <$EMAIL>" \
    --in-place "$1"

@M95D
Copy link
Contributor Author

M95D commented May 21, 2024

PS:
Someone should check what branch build bots are using...

Copy link
Member

@KanjiMonster KanjiMonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now

Fix revision calculation when local branch is rebased on new "main" branch
instead of "master".

Signed-off-by: Marius Dinu <m95d+git@psihoexpert.ro>
Link: openwrt#15538
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
@openwrt-bot openwrt-bot merged commit 9db53fb into openwrt:main May 21, 2024
2 checks passed
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Jun 8, 2024
Fix revision calculation when local branch is rebased on new "main" branch
instead of "master".

Signed-off-by: Marius Dinu <m95d+git@psihoexpert.ro>
Link: openwrt#15538
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/scripts/tools pull request/issues for build, scripts and tools related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants