<?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>171450</bug_id>
          
          <creation_ts>2017-04-28 14:28:10 -0700</creation_ts>
          <short_desc>Add a new function for getting the Git hash for a pure git directory.</short_desc>
          <delta_ts>2017-05-01 16:15:38 -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 Nightly 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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jason Marcell">jmarcell</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bshafiei</cc>
    
    <cc>buildbot</cc>
    
    <cc>dbates</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>jmarcell</cc>
    
    <cc>kocsen_chung</cc>
    
    <cc>lforschler</cc>
    
    <cc>matthew_hanson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1302788</commentid>
    <comment_count>0</comment_count>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-04-28 14:28:10 -0700</bug_when>
    <thetext>Add a new function for getting the Git hash for a pure git directory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302791</commentid>
    <comment_count>1</comment_count>
      <attachid>308595</attachid>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-04-28 14:29:40 -0700</bug_when>
    <thetext>Created attachment 308595
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302798</commentid>
    <comment_count>2</comment_count>
      <attachid>308595</attachid>
    <who name="Matthew Hanson">matthew_hanson</who>
    <bug_when>2017-04-28 14:38:39 -0700</bug_when>
    <thetext>Comment on attachment 308595
Patch

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

Perhaps we should warn the user if the directory is not a Git directory, since that is likely indicative of a mistake on the part of the caller.

This is a great addition; The semicolon needs to be addressed and I&apos;d like to see a warning when this function is called on non-Git repos.

&gt; Tools/Scripts/VCSUtils.pm:451
&gt; +    my $revision;

I know that the variable name $revision is consistent with the other functions of this ilk, but you might consider calling it $commit or $hash to match the name of your function.

&gt; Tools/Scripts/VCSUtils.pm:454
&gt; +        warn &quot;$directory is a pure git repo.&quot;;

Is this debugging code?

&gt; Tools/Scripts/VCSUtils.pm:458
&gt; +        chomp($revision)

Missing semicolon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302806</commentid>
    <comment_count>3</comment_count>
      <attachid>308595</attachid>
    <who name="Kocsen Chung">kocsen_chung</who>
    <bug_when>2017-04-28 14:47:27 -0700</bug_when>
    <thetext>Comment on attachment 308595
Patch

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

&gt;&gt; Tools/Scripts/VCSUtils.pm:454
&gt;&gt; +        warn &quot;$directory is a pure git repo.&quot;;
&gt; 
&gt; Is this debugging code?

I assume we also don&apos;t mind that git-svn repos will execute this code path.

&gt; Tools/Scripts/VCSUtils.pm:456
&gt; +        $command = &quot;LC_ALL=C $command&quot; if !isWindows();

Curious what is this for?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302816</commentid>
    <comment_count>4</comment_count>
      <attachid>308595</attachid>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-04-28 15:19:21 -0700</bug_when>
    <thetext>Comment on attachment 308595
Patch

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

&gt;&gt; Tools/Scripts/VCSUtils.pm:451
&gt;&gt; +    my $revision;
&gt; 
&gt; I know that the variable name $revision is consistent with the other functions of this ilk, but you might consider calling it $commit or $hash to match the name of your function.

Yep. I guess I&apos;ll go with $commit unless anyone objects.

&gt;&gt;&gt; Tools/Scripts/VCSUtils.pm:454
&gt;&gt;&gt; +        warn &quot;$directory is a pure git repo.&quot;;
&gt;&gt; 
&gt;&gt; Is this debugging code?
&gt; 
&gt; I assume we also don&apos;t mind that git-svn repos will execute this code path.

This is debugging code (which I will remove before landing). This function will work fine for a git-svn repo, however, we wouldn&apos;t/shouldn&apos;t use it because there is an already-existing function called `svnRevisionForDirectory` (which, not coincidentally, this function was heavily based on).

&gt;&gt; Tools/Scripts/VCSUtils.pm:456
&gt;&gt; +        $command = &quot;LC_ALL=C $command&quot; if !isWindows();
&gt; 
&gt; Curious what is this for?

I&apos;m not sure. It&apos;s some copy pasta from `svnRevisionForDirectory`. You&apos;re right to question it. We should figure out if we even need it here before landing.

&gt;&gt; Tools/Scripts/VCSUtils.pm:458
&gt;&gt; +        chomp($revision)
&gt; 
&gt; Missing semicolon.

Will fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303260</commentid>
    <comment_count>5</comment_count>
      <attachid>308595</attachid>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-05-01 09:52:07 -0700</bug_when>
    <thetext>Comment on attachment 308595
Patch

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

&gt;&gt;&gt; Tools/Scripts/VCSUtils.pm:456
&gt;&gt;&gt; +        $command = &quot;LC_ALL=C $command&quot; if !isWindows();
&gt;&gt; 
&gt;&gt; Curious what is this for?
&gt; 
&gt; I&apos;m not sure. It&apos;s some copy pasta from `svnRevisionForDirectory`. You&apos;re right to question it. We should figure out if we even need it here before landing.

I&apos;ve done some research. Why do this?
From here: https://unix.stackexchange.com/a/87763

We&apos;re setting the locale to something generic in this case because the returned data is not intended for human consumption and, thus, does not need locale specific interpretation.

&gt; Any time where you process input data or output data that is not intended from/for a human. If you&apos;re talking to a user, you may want to use their convention and language, but for instance, if you generate some numbers to feed some other application that expects English style decimal points, or English month names, you&apos;ll want to set LC_ALL=C

Why are we excluding Windows?
https://bugs.webkit.org/show_bug.cgi?id=93339</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303266</commentid>
    <comment_count>6</comment_count>
      <attachid>308595</attachid>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-05-01 09:59:45 -0700</bug_when>
    <thetext>Comment on attachment 308595
Patch

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

&gt;&gt;&gt; Tools/Scripts/VCSUtils.pm:451
&gt;&gt;&gt; +    my $revision;
&gt;&gt; 
&gt;&gt; I know that the variable name $revision is consistent with the other functions of this ilk, but you might consider calling it $commit or $hash to match the name of your function.
&gt; 
&gt; Yep. I guess I&apos;ll go with $commit unless anyone objects.

Actually, I decided to go with &apos;hash&apos; because of the name I already chose for the function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303270</commentid>
    <comment_count>7</comment_count>
      <attachid>308728</attachid>
    <who name="Jason Marcell">jmarcell</who>
    <bug_when>2017-05-01 10:05:20 -0700</bug_when>
    <thetext>Created attachment 308728
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303320</commentid>
    <comment_count>8</comment_count>
      <attachid>308728</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2017-05-01 12:11:08 -0700</bug_when>
    <thetext>Comment on attachment 308728
Patch

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

r=me

&gt; Tools/Scripts/VCSUtils.pm:96
&gt;          &amp;svnRevisionForDirectory
&gt; +        &amp;gitHashForDirectory
&gt;          &amp;svnStatus

Please alphabetize within the list.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>308595</attachid>
            <date>2017-04-28 14:29:40 -0700</date>
            <delta_ts>2017-05-01 10:05:18 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-171450-20170428142940.patch</filename>
            <type>text/plain</type>
            <size>1748</size>
            <attacher name="Jason Marcell">jmarcell</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE1OTQ3CmRpZmYgLS1naXQgYS9Ub29scy9DaGFuZ2VMb2cg
Yi9Ub29scy9DaGFuZ2VMb2cKaW5kZXggYzE4ZWNhNjI5ZjFhYWEwNWFjNjUwNzdlYzIyNDNiZmU3
MmYwNDg4OC4uMGJkZDM3NTJkNTkxZDAzNjA5ZWQ0MmViNmI0YjQ1MDg4MGU0Zjg2ZiAxMDA2NDQK
LS0tIGEvVG9vbHMvQ2hhbmdlTG9nCisrKyBiL1Rvb2xzL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEz
IEBACisyMDE3LTA0LTI4ICBKYXNvbiBNYXJjZWxsICA8am1hcmNlbGxAYXBwbGUuY29tPgorCisg
ICAgICAgIEFkZCBhIG5ldyBmdW5jdGlvbiBmb3IgZ2V0dGluZyB0aGUgR2l0IGhhc2ggZm9yIGEg
cHVyZSBnaXQgZGlyZWN0b3J5LgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93
X2J1Zy5jZ2k/aWQ9MTcxNDUwCisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISku
CisKKyAgICAgICAgKiBTY3JpcHRzL1ZDU1V0aWxzLnBtOgorICAgICAgICAoZ2l0SGFzaEZvckRp
cmVjdG9yeSk6CisKIDIwMTctMDQtMjggIENocmlzIER1bWV6ICA8Y2R1bWV6QGFwcGxlLmNvbT4K
IAogICAgICAgICBVcGRhdGUgRE9NVG9rZW5MaXN0LnJlcGxhY2UoKSB0byBtYXRjaCB0aGUgbGF0
ZXN0IERPTSBzcGVjaWZpY2F0aW9uCmRpZmYgLS1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bmQiIGlmICFpc1dpbmRvd3MoKTsKKyAgICAgICAgJHJldmlz
aW9uID0gYCRjb21tYW5kYDsKKyAgICAgICAgY2hvbXAoJHJldmlzaW9uKQorICAgIH0KKyAgICBp
ZiAoIWRlZmluZWQoJHJldmlzaW9uKSkgeworICAgICAgICAkcmV2aXNpb24gPSAidW5rbm93biI7
CisgICAgICAgIHdhcm4gIlVuYWJsZSB0byBkZXRlcm1pbmUgY3VycmVudCBHaXQgaGFzaCBpbiAk
ZGlyZWN0b3J5IjsKKyAgICB9CisgICAgcmV0dXJuICRyZXZpc2lvbjsKK30KKwogc3ViIHN2bklu
Zm9Gb3JQYXRoKCQpCiB7CiAgICAgbXkgKCRmaWxlKSA9IEBfOwo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>308728</attachid>
            <date>2017-05-01 10:05:20 -0700</date>
            <delta_ts>2017-05-01 12:11:08 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-171450-20170501100519.patch</filename>
            <type>text/plain</type>
            <size>1662</size>
            <attacher name="Jason Marcell">jmarcell</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE2MDE1CmRpZmYgLS1naXQgYS9Ub29scy9DaGFuZ2VMb2cg
Yi9Ub29scy9DaGFuZ2VMb2cKaW5kZXggN2I0ZTlhNmNkNDczODk3YTNiMmNjYWVkZDE0Mjg0YTM1
MjkxMmYwNS4uNDcyYTk5ZGNlMzE5MmI5ZjBiMTE2NGM3YWQzNGQ1MTEwNjNkZDA4YyAxMDA2NDQK
LS0tIGEvVG9vbHMvQ2hhbmdlTG9nCisrKyBiL1Rvb2xzL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEz
IEBACisyMDE3LTA1LTAxICBKYXNvbiBNYXJjZWxsICA8am1hcmNlbGxAYXBwbGUuY29tPgorCisg
ICAgICAgIEFkZCBhIG5ldyBmdW5jdGlvbiBmb3IgZ2V0dGluZyB0aGUg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lzaW9uRm9yRGlyZWN0b3J5KCQpCiAg
ICAgcmV0dXJuICRyZXZpc2lvbjsKIH0KIAorc3ViIGdpdEhhc2hGb3JEaXJlY3RvcnkoJCkKK3sK
KyAgICBteSAoJGRpcmVjdG9yeSkgPSBAXzsKKyAgICBteSAkaGFzaDsKKworICAgIGlmIChpc0dp
dERpcmVjdG9yeSgkZGlyZWN0b3J5KSkgeworICAgICAgICBteSAkY29tbWFuZCA9ICJnaXQgLUMg
XCIkZGlyZWN0b3J5XCIgcmV2LXBhcnNlIEhFQUQiOworICAgICAgICAkY29tbWFuZCA9ICJMQ19B
TEw9QyAkY29tbWFuZCIgaWYgIWlzV2luZG93cygpOworICAgICAgICAkaGFzaCA9IGAkY29tbWFu
ZGA7CisgICAgICAgIGNob21wKCRoYXNoKTsKKyAgICB9CisgICAgaWYgKCFkZWZpbmVkKCRoYXNo
KSkgeworICAgICAgICAkaGFzaCA9ICJ1bmtub3duIjsKKyAgICAgICAgd2FybiAiVW5hYmxlIHRv
IGRldGVybWluZSBjdXJyZW50IEdpdCBoYXNoIGluICRkaXJlY3RvcnkiOworICAgIH0KKyAgICBy
ZXR1cm4gJGhhc2g7Cit9CisKIHN1YiBzdm5JbmZvRm9yUGF0aCgkKQogewogICAgIG15ICgkZmls
ZSkgPSBAXzsK
</data>
<flag name="review"
          id="329872"
          type_id="1"
          status="+"
          setter="ddkilzer"
    />
          </attachment>
      

    </bug>

</bugzilla>