clang-format-diff.py disagrees with itself when running in-place or not |
||||||||
Issue descriptionD:\src>git cl format D:\src>git status On branch fix Your branch is ahead of 'master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean D:\src>git cl upload Using 50% similarity for rename/copy detection. Override with --similarity. Running presubmit upload checks ... ** Presubmit Warnings ** The src directory requires source formatting. Please run git cl format . Presubmit checks took 4.7s to calculate. Repro environment: Trunk: d00656ece1ae3378d3206cb5aca23d4566158b6d Patch: Attached
,
Mar 6 2017
,
Mar 6 2017
,
Mar 6 2017
This has nothing to do with codereview either nor with git cl. This analysis is ran by Chromium's PRESUBMIT script. I don't know who is responsible for it.
,
Mar 13 2017
,
Mar 15 2017
I reproduce the failure. The presubmit check that chromium is running just calls "git cl format --dry-run". For some reason, the --dry-run flag results in an error return code even though actually running the format results in no changes. So here's an analysis of what's going on: * When "git cl format" is run, it only returns non-zero when both the --dry-run flag was passed *and* the length of the output of the underlying clang-format tool is non-zero * The length of the output of the underlying clang-format tool is non-zero when both it has changes to make *and* the -i (in place) flag wasn't passed So the question becomes: when the -i flag is passed to the underlying clang-format tool, does it return an error code which "git cl format" ignores? Or does it report success? I reconstructed the command that "git cl format" is executing: > git diff --no-ext-diff --no-prefix -U0 d00656ece -- `git diff --no-ext-diff --no-prefix --name-only d00656ece` | python ./buildtools/clang_format/script/clang-format-diff.py -p0 -i > echo $? 0 Ok, so this isn't git-cl format's fault. This is the fault of clang-format-diff.py. When passed the "-i" flag, it makes no changes. When not passed the "-i" flag, it returns a diff that it thinks should be applied. I'm updating the subject and component of this bug to reflect this actual issue. I'm also CCing djasper@, who has the majority of recent commits to clang-format-diff and is a googler.
,
Oct 26 2017
,
Oct 29
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by robliao@chromium.org
, Mar 3 2017