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
tools/shellcheck: git log ${TRAVIS_COMMIT_RANGE/.../..} #192
Conversation
a3ae054
to
87211b8
Compare
87211b8
to
9bb17a6
Compare
it's not that simple, need more time. |
$TRAVIS_COMMIT_RANGE contains triple dots, e.g. "origin/master...HEAD". This is great for git diff but unsuitable for git log. Convert any triple dots to double dots before passing to git log (don't change the argument for git diff --name-only). Also use a more verbose git log command and --no-pager instead of the gross '|cat ': the sanity check was reporting issues but always reporting success. Fixes: faadb20 ("CI: travis: new shellcheck-gitrange.bash") Signed-off-by: Marc Herbert <marc.herbert@intel.com>
9bb17a6
to
71e84d9
Compare
@marc-hb I dont understand why you need ... for git diff and .. for git log. I'd think that in both cases .. should suffice. The difference between the 2 as I understand is whether the starting commit SHA1 is included or not. |
Nope. https://matthew-brett.github.io/pydagogue/pain_in_dots.html#pain-in-dots The triple dots is needed for
That's why Could/should This PR removes the triple dot for |
@marc-hb I am probably missing the bigger picture of how this range gets used. What are we doing with the diff and log? |
Extracting and showing filenames and commits of the PR and only of the PR.
Opposite indeed. This is not just for TRAVIS_COMMIT_RANGE; a
|
@marc-hb typically we do a rebase and merge for PR's isnt it? So, why not checkout the PR locally and rebase on top of master. Then a .. would suffice for both cases? Maybe Im oversimplifying |
Ideally, CI would test every PR BOTH before and after rebase. In practice testing only before rebase is much simpler and is what the SOF project does right now. This small logging change merely adjusts to this reality and to git's broken user interface. [off topic] |
@marc-hb fair enough. Lets go ahead with the change. |
local logrange=${diffrange/.../..} | ||
( set -x | ||
# also a sanity check of the argument | ||
git --no-pager log --oneline --graph --stat --max-count=40 "$logrange" -- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This git log command shows which commits are being checked for logging purposes. It also aborts the script early if "$1" is not valid.
The git diff command below extracts all the names of the files (fname
) modified by the PR
Those are two different operations that need different commands with a slightly different argument. I'm not sure I understand the question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@libinyang I believe git log is still the correct command for doing the sanity check, so this seems correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
local logrange=${diffrange/.../..} | ||
( set -x | ||
# also a sanity check of the argument | ||
git --no-pager log --oneline --graph --stat --max-count=40 "$logrange" -- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@libinyang I believe git log is still the correct command for doing the sanity check, so this seems correct.
$TRAVIS_COMMIT_RANGE contains triple dots,
e.g. "origin/master...HEAD". This is great for git diff but unsuitable
for git log. Convert any triple dots to double dots before passing to
git log (don't change the argument for git diff --name-only).
Also use a more verbose git log command and --no-pager instead of the
gross '|cat ': the sanity check was reporting issues but always
reporting success.
Fixes: faadb20 ("CI: travis: new shellcheck-gitrange.bash")
Signed-off-by: Marc Herbert marc.herbert@intel.com