New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 698132 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

clang-format-diff.py disagrees with itself when running in-place or not

Project Member Reported by robliao@chromium.org, Mar 3 2017

Issue description

D:\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
 
repro.patch
18.2 KB Download
Components: Infra

Comment 2 by mmoss@chromium.org, Mar 6 2017

Components: -Infra Infra>Codereview Infra>SDK
Cc: aga...@chromium.org
Owner: tandrii@chromium.org
Status: Assigned (was: Untriaged)
Components: -Infra>Codereview -Infra>SDK Infra>Client>Chrome
Owner: ----
Status: Available (was: Assigned)
Summary: Chromium PRESUBMIT Spuriously Warns about Running git cl format (was: git cl upload Spuriously Warns about Running git cl format)
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.
Status: Untriaged (was: Available)

Comment 6 by aga...@chromium.org, Mar 15 2017

Cc: djasper@google.com
Components: -Infra>Client>Chrome
Status: Available (was: Untriaged)
Summary: clang-format-diff.py disagrees with itself when running in-place or not (was: Chromium PRESUBMIT Spuriously Warns about Running git cl format)
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.
Components: Tools
Project Member

Comment 8 by sheriffbot@chromium.org, Oct 29

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
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