scripts: clang-format can use a different base than master

useful for git hook running on main-7.0.x branches so that
not every commit gets its format checked again.

Ticket: 7292
(cherry picked from commit cca169f307)
pull/13296/head
Philippe Antoine 5 months ago
parent 5ef11ae022
commit a348f36cd8

@ -61,7 +61,7 @@ proper it provides additional functionality such as reformatting of all commits
Commands used in various situations:
Formatting branch changes (compared to master):
Formatting branch changes (compared to master or SURICATA_BRANCH env variable):
branch Format all changes in branch as additional commit
rewrite-branch Format every commit in branch and rewrite history
@ -335,14 +335,15 @@ function HelpCommand {
esac
}
# Return first commit of branch (off master).
# Return first commit of branch (off master or SURICATA_BRANCH env variable).
#
# Use $first_commit^ if you need the commit on master we branched off.
# Do not compare with master directly as it will diff with the latest commit
# on master. If our branch has not been rebased on the latest master, this
# would result in including all new commits on master!
function FirstCommitOfBranch {
local first_commit=$(git rev-list origin/master..HEAD | tail -n 1)
start="${SURICATA_BRANCH:-origin/master}"
local first_commit=$(git rev-list $start..HEAD | tail -n 1)
echo $first_commit
}

Loading…
Cancel
Save