<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>171085</bug_id>
          
          <creation_ts>2017-04-20 15:56:54 -0700</creation_ts>
          <short_desc>commit-log-editor should respect the git editor if one is set</short_desc>
          <delta_ts>2017-04-21 10:27:27 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Conrad Shultz">conrad_shultz</reporter>
          <assigned_to name="Conrad Shultz">conrad_shultz</assigned_to>
          <cc>conrad_shultz</cc>
    
    <cc>dbates</cc>
    
    <cc>kocsen_chung</cc>
    
    <cc>lforschler</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1299354</commentid>
    <comment_count>0</comment_count>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-20 15:56:54 -0700</bug_when>
    <thetext>commit-log-editor currently will consider SVN and CVS editor preferences. It should also respect the git editor if one is set through GIT_EDITOR or the global git config.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299359</commentid>
    <comment_count>1</comment_count>
      <attachid>307656</attachid>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-20 16:01:08 -0700</bug_when>
    <thetext>Created attachment 307656
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299362</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-04-20 16:02:51 -0700</bug_when>
    <thetext>&lt;rdar://problem/31745506&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299371</commentid>
    <comment_count>3</comment_count>
    <who name="Kocsen Chung">kocsen_chung</who>
    <bug_when>2017-04-20 16:16:30 -0700</bug_when>
    <thetext>Changes look good. 

For git/git-svn users, have we considered using a `prepare-commit-msg` hook (https://git-scm.com/docs/githooks#_prepare_commit_msg).
And allow git to deal with the &quot;editor setting&quot; logic?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299374</commentid>
    <comment_count>4</comment_count>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-20 16:17:54 -0700</bug_when>
    <thetext>(In reply to Kocsen Chung from comment #3)
&gt; Changes look good. 
&gt; 
&gt; For git/git-svn users, have we considered using a `prepare-commit-msg` hook
&gt; (https://git-scm.com/docs/githooks#_prepare_commit_msg).
&gt; And allow git to deal with the &quot;editor setting&quot; logic?

I haven&apos;t looked into that; I tried, for now, to keep the logic as similar as possible to what we&apos;re doing for other SCMs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299386</commentid>
    <comment_count>5</comment_count>
      <attachid>307656</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-04-20 16:45:05 -0700</bug_when>
    <thetext>Comment on attachment 307656
Patch

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

&gt; Tools/Scripts/commit-log-editor:97
&gt; +if (isGit()) {
&gt; +    $editor = $ENV{GIT_EDITOR};
&gt; +    $editor = `git config --global --get core.editor` if !$editor;
&gt; +}

Take GIT_EDITOR := vi and &quot;git config core.editor&quot; := Tools/Scripts/commit-log-editor. Make a change to some file and run &quot;git commit -a&quot;. Then Git will invoke vi directly instead of commit-log-editor by definition of GIT_EDITOR in &lt;https://git-scm.com/docs/git-var#_variables&gt;. That is, we never run this code.

We should take a similar approach as for SVN_LOG_EDITOR and CVS_LOG_EDITOR and query for an environment variable that does not coincide with an environment variable used by Git, say GIT_LOG_EDITOR.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299399</commentid>
    <comment_count>6</comment_count>
      <attachid>307665</attachid>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-20 17:01:04 -0700</bug_when>
    <thetext>Created attachment 307665
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299401</commentid>
    <comment_count>7</comment_count>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-20 17:01:24 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #5)
&gt; Comment on attachment 307656 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=307656&amp;action=review
&gt; 
&gt; &gt; Tools/Scripts/commit-log-editor:97
&gt; &gt; +if (isGit()) {
&gt; &gt; +    $editor = $ENV{GIT_EDITOR};
&gt; &gt; +    $editor = `git config --global --get core.editor` if !$editor;
&gt; &gt; +}
&gt; 
&gt; Take GIT_EDITOR := vi and &quot;git config core.editor&quot; :=
&gt; Tools/Scripts/commit-log-editor. Make a change to some file and run &quot;git
&gt; commit -a&quot;. Then Git will invoke vi directly instead of commit-log-editor by
&gt; definition of GIT_EDITOR in &lt;https://git-scm.com/docs/git-var#_variables&gt;.
&gt; That is, we never run this code.
&gt; 
&gt; We should take a similar approach as for SVN_LOG_EDITOR and CVS_LOG_EDITOR
&gt; and query for an environment variable that does not coincide with an
&gt; environment variable used by Git, say GIT_LOG_EDITOR.

Agreed; posted a new version using GIT_LOG_EDITOR.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299417</commentid>
    <comment_count>8</comment_count>
      <attachid>307665</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-04-20 17:23:42 -0700</bug_when>
    <thetext>Comment on attachment 307665
Patch

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

&gt; Tools/ChangeLog:10
&gt; +        If git is available, consider GIT_LOG_EDITOR and any global git editor preference when deciding which editor to present.
&gt; +        We examine the global editor preference since that may be set automatically by installers or third-party tools.

Nit: git =&gt; Git
(You mention Git twice in line 9)

It is an unwritten convention that we tend to wrap ChangeLog lines that exceed ~100 characters.

&gt; Tools/Scripts/commit-log-editor:97
&gt; +if (isGit()) {
&gt; +    $editor = $ENV{GIT_LOG_EDITOR};
&gt; +    $editor = `git config --global --get core.editor` if !$editor;
&gt; +}

The behavior of this code to query the global git core editor may surprise a person that never defines GIT_LOG_EDITOR,  SVN_LOG_EDITOR, or CVS_LOG_EDITOR and uses commit-log-editor located in a Git checkout of WebKit in projects that use other version control systems because isGit() will return true (since the WebKit checkout is Git-based). Though a similar surprise may arise if a person just set GIT_LOG_EDITOR when using commit-log-editor in such a scenario.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299418</commentid>
    <comment_count>9</comment_count>
      <attachid>307665</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-04-20 17:24:33 -0700</bug_when>
    <thetext>Comment on attachment 307665
Patch

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

&gt; Tools/ChangeLog:4
&gt; +        https://bugs.webkit.org/show_bug.cgi?id=171085

Please add the radar bug URL, &lt;rdar://problem/31745506&gt;, under this line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299669</commentid>
    <comment_count>10</comment_count>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-21 10:22:40 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #8)
&gt; Comment on attachment 307665 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=307665&amp;action=review
&gt; 
&gt; &gt; Tools/ChangeLog:10
&gt; &gt; +        If git is available, consider GIT_LOG_EDITOR and any global git editor preference when deciding which editor to present.
&gt; &gt; +        We examine the global editor preference since that may be set automatically by installers or third-party tools.
&gt; 
&gt; Nit: git =&gt; Git
&gt; (You mention Git twice in line 9)

Fixed in both places.
&gt; 
&gt; It is an unwritten convention that we tend to wrap ChangeLog lines that
&gt; exceed ~100 characters.

Fixed.

&gt; 
&gt; &gt; Tools/Scripts/commit-log-editor:97
&gt; &gt; +if (isGit()) {
&gt; &gt; +    $editor = $ENV{GIT_LOG_EDITOR};
&gt; &gt; +    $editor = `git config --global --get core.editor` if !$editor;
&gt; &gt; +}
&gt; 
&gt; The behavior of this code to query the global git core editor may surprise a
&gt; person that never defines GIT_LOG_EDITOR,  SVN_LOG_EDITOR, or CVS_LOG_EDITOR
&gt; and uses commit-log-editor located in a Git checkout of WebKit in projects
&gt; that use other version control systems because isGit() will return true
&gt; (since the WebKit checkout is Git-based). Though a similar surprise may
&gt; arise if a person just set GIT_LOG_EDITOR when using commit-log-editor in
&gt; such a scenario.

Agreed.

Also added the radar URL. Thanks for the review!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1299673</commentid>
    <comment_count>11</comment_count>
    <who name="Conrad Shultz">conrad_shultz</who>
    <bug_when>2017-04-21 10:27:27 -0700</bug_when>
    <thetext>Committed r215615 = 3415f0bae58df85cfdfa29a9c84b402c73238ab1
http://svn.webkit.org/repository/webkit/trunk@215615</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>307656</attachid>
            <date>2017-04-20 16:01:08 -0700</date>
            <delta_ts>2017-04-20 17:01:03 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-171085-20170420160108.patch</filename>
            <type>text/plain</type>
            <size>1393</size>
            <attacher name="Conrad Shultz">conrad_shultz</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE1NTY1CmRpZmYgLS1naXQgYS9Ub29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gppbmRleCAyZmYwZmEzMzJmZmY3OWZh
M2RjZjJhNzNjZDU2NDNkNTA3Zjk2M2IzLi4xNzY3MmE3OTM4NDY4ZWQ2MjM4ZmRhMGVmNWJkYzg1
YmIwMzllYmQ5IDEwMDc1NQotLS0gYS9Ub29scy9TY3JpcHRzL2NvbW1pdC1sb2ctZWRpdG9yCisr
KyBiL1Rvb2xzL1NjcmlwdHMvY29tbWl0LWxvZy1lZGl0b3IKQEAgLTkwLDcgKzkwLDEzIEBAIGlm
ICghJGxvZykgewogCiBteSAkYmFzZURpciA9IGJhc2VQcm9kdWN0RGlyKCk7CiAKLW15ICRlZGl0
b3IgPSAkRU5We1NWTl9MT0dfRURJVE9SfTsKK215ICRlZGl0b3I7CitpZiAoaXNHaXQoKSkgewor
ICAgICRlZGl0b3IgPSAkRU5We0dJVF9FRElUT1J9OworICAgICRlZGl0b3IgPSBgZ2l0IGNvbmZp
ZyAtLWdsb2JhbCAtLWdldCBjb3JlLmVkaXRvcmAgaWYgISRlZGl0b3I7Cit9CisKKyRlZGl0b3Ig
PSAkRU5We1NWTl9MT0dfRURJVE9SfSBpZiAhJGVkaXRvcjsKICRlZGl0b3IgPSAkRU5We0NWU19M
T0dfRURJVE9SfSBpZiAhJGVkaXRvcjsKICRlZGl0b3IgPSAiIiBpZiAkZWRpdG9yICYmIGlzQ29t
bWl0TG9nRWRpdG9yKCRlZGl0b3IpOwogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>307665</attachid>
            <date>2017-04-20 17:01:04 -0700</date>
            <delta_ts>2017-04-20 17:23:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-171085-20170420170104.patch</filename>
            <type>text/plain</type>
            <size>1522</size>
            <attacher name="Conrad Shultz">conrad_shultz</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE1NTY1CmRpZmYgLS1naXQgYS9Ub29scy9DaGFuZ2VMb2cg
Yi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Ghl
IGxhdGVzdCBzdGFibGUgdmVyc2lvbnMKZGlmZiAtLWdpdCBhL1Rvb2xzL1NjcmlwdHMvY29tbWl0
LWxvZy1lZGl0b3IgYi9Ub29scy9TY3JpcHRzL2NvbW1pdC1sb2ctZWRpdG9yCmluZGV4IDJmZjBm
YTMzMmZmZjc5ZmEzZGNmMmE3M2NkNTY0M2Q1MDdmOTYzYjMuLjgyM2FkZGUwNTE4MDc3NDdmNTg0
ZWI5NmI0Njg5NzJiYjhlOTY3NjQgMTAwNzU1Ci0tLSBhL1Rvb2xzL1NjcmlwdHMvY29tbWl0LWxv
Zy1lZGl0b3IKKysrIGIvVG9vbHMvU2NyaXB0cy9jb21taXQtbG9nLWVkaXRvcgpAQCAtOTAsNyAr
OTAsMTMgQEAgaWYgKCEkbG9nKSB7CiAKIG15ICRiYXNlRGlyID0gYmFzZVByb2R1Y3REaXIoKTsK
IAotbXkgJGVkaXRvciA9ICRFTlZ7U1ZOX0xPR19FRElUT1J9OworbXkgJGVkaXRvcjsKK2lmIChp
c0dpdCgpKSB7CisgICAgJGVkaXRvciA9ICRFTlZ7R0lUX0xPR19FRElUT1J9OworICAgICRlZGl0
b3IgPSBgZ2l0IGNvbmZpZyAtLWdsb2JhbCAtLWdldCBjb3JlLmVkaXRvcmAgaWYgISRlZGl0b3I7
Cit9CisKKyRlZGl0b3IgPSAkRU5We1NWTl9MT0dfRURJVE9SfSBpZiAhJGVkaXRvcjsKICRlZGl0
b3IgPSAkRU5We0NWU19MT0dfRURJVE9SfSBpZiAhJGVkaXRvcjsKICRlZGl0b3IgPSAiIiBpZiAk
ZWRpdG9yICYmIGlzQ29tbWl0TG9nRWRpdG9yKCRlZGl0b3IpOwogCg==
</data>
<flag name="review"
          id="328914"
          type_id="1"
          status="+"
          setter="dbates"
    />
          </attachment>
      

    </bug>

</bugzilla>