Bug 186810

Summary: [style] Fix --git-index option for check-webkit-style command
Product: WebKit Reporter: Basuke Suzuki <Basuke.Suzuki>
Component: Tools / TestsAssignee: Basuke Suzuki <Basuke.Suzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, ap, Basuke.Suzuki, bugs-noreply, calvaris, commit-queue, darin, dbates, ddkilzer, ews-bot+gtk-3, ews-watchlist, glenn, jbedard, lforschler, mcatanzaro, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
FIX
none
Add unittest
dbates: review+, ews-watchlist: commit-queue-
Archive of layout-test-results from ews206 for win-future
none
Archive of layout-test-results from ews126 for ios-simulator-wk2
none
fix none

Description Basuke Suzuki 2018-06-19 11:53:58 PDT
It doesn't work well if master is out of sync with origin/master.
Comment 1 Basuke Suzuki 2018-06-19 12:40:08 PDT
Created attachment 343082 [details]
FIX
Comment 2 Jonathan Bedard 2018-06-19 14:24:44 PDT
Is it possible to write unit tests for this?  We have scm unit tests in webkitpy/common/checkout/scm/scm_unittest.py. These tests actually instantiate repositories locally, they're slow, but this seems like the kind of weird edge case that warrants tests.
Comment 3 Basuke Suzuki 2018-06-19 14:52:24 PDT
Oh, yea. I'll try.
Comment 4 Basuke Suzuki 2018-06-21 13:55:20 PDT
Created attachment 343273 [details]
Add unittest
Comment 5 Basuke Suzuki 2018-06-21 13:55:52 PDT
$ python Tools/Scripts/test-webkitpy webkitpy.common.checkout.scm.scm_unittest.GitTest
Comment 6 Jonathan Bedard 2018-06-21 15:01:58 PDT
Confirmed these tests locally, the last question: should this be the behavior?

If I'm understanding this correctly, this change means that if I have a local commit and have added, but not committed, additional changes, both the local commit and uncommitted files would be included.

I use svn, so I'm probably not the right person to make this call.
Comment 7 Basuke Suzuki 2018-06-21 15:14:05 PDT
Git is different from svn that git has an indexed state, which is intermediate state between uncommitted and committed. It exists only one for a repository. So if the command line argument says "please compare with index", that means scan staged files only. 

Here is the document of this option.

>   --git-index           Scan staged files only

It says stated files only. (Staged file means the files in index state).
And this option to create_patch() method only passed from check-webkit-style script.
Comment 8 EWS Watchlist 2018-06-21 16:25:51 PDT
Comment on attachment 343273 [details]
Add unittest

Attachment 343273 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8282659

New failing tests:
http/tests/security/canvas-remote-read-remote-video-localhost.html
Comment 9 EWS Watchlist 2018-06-21 16:26:03 PDT
Created attachment 343287 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 10 EWS Watchlist 2018-06-21 18:07:59 PDT
Comment on attachment 343273 [details]
Add unittest

Attachment 343273 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/8283656

New failing tests:
imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.html
Comment 11 EWS Watchlist 2018-06-21 18:08:01 PDT
Created attachment 343300 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.4
Comment 12 Daniel Bates 2018-06-22 08:27:16 PDT
Comment on attachment 343273 [details]
Add unittest

View in context: https://bugs.webkit.org/attachment.cgi?id=343273&action=review

> Tools/Scripts/webkitpy/common/checkout/scm/git.py:341
> +        command = [self.executable_name, 'diff', '--binary', '--no-color', "--no-ext-diff", "--full-index", "--no-renames", order]

We should take this opportunity to fix the style in this lien and make all literals single quoted.
Comment 13 Basuke Suzuki 2018-06-22 12:17:13 PDT
(In reply to Daniel Bates from comment #12)
> Comment on attachment 343273 [details]
> Add unittest
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=343273&action=review
> 
> > Tools/Scripts/webkitpy/common/checkout/scm/git.py:341
> > +        command = [self.executable_name, 'diff', '--binary', '--no-color', "--no-ext-diff", "--full-index", "--no-renames", order]
> 
> We should take this opportunity to fix the style in this lien and make all
> literals single quoted.

Sure I do. For the reference, where can I find those Python coding style guideline?

Thanks for r+.
Comment 14 Basuke Suzuki 2018-06-22 13:33:11 PDT
Created attachment 343360 [details]
fix
Comment 15 WebKit Commit Bot 2018-06-22 13:50:52 PDT
Comment on attachment 343360 [details]
fix

Clearing flags on attachment: 343360

Committed r233097: <https://trac.webkit.org/changeset/233097>
Comment 16 WebKit Commit Bot 2018-06-22 13:50:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Radar WebKit Bug Importer 2018-06-22 13:52:31 PDT
<rdar://problem/41380569>
Comment 18 Michael Catanzaro 2018-06-22 14:48:54 PDT
(In reply to Basuke Suzuki from comment #13)
> Sure I do. For the reference, where can I find those Python coding style
> guideline?

I'm not sure if it's written down anywhere, but it is PEP 8 minus the line length limit.
Comment 19 Daniel Bates 2018-06-26 19:54:27 PDT
(In reply to Michael Catanzaro from comment #18)
> (In reply to Basuke Suzuki from comment #13)
> > Sure I do. For the reference, where can I find those Python coding style
> > guideline?
> 
> I'm not sure if it's written down anywhere, but it is PEP 8 minus the line
> length limit.

The PEP 8 requirement is written down at <https://webkit.org/code-style-guidelines/#python>. We should amend the guidelines to add a remark that we do not respect the line length limit. See the discussion on bug #179387.