<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - pre-commit check for allownonascii is incorrect"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=134286">134286</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>pre-commit check for allownonascii is incorrect
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0.0.0.beta1+
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>trivial
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>shiro.kawai@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In pre-commit git hook, non-ascii filenames are checked unless `git config
hooks.allownonascii` is "true".  However, the comparison $allownonascii ne
"true" is done without trailing newline, the hook always exists no matter what
the value of hooks.allownonascii is.

I don't intend to commit files with non-ascii filenames into the main repo, but
we needed it in our local fork.

Here's a suggested patch.


--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -280,6 +280,7 @@ if ( system( "git rev-parse --verify HEAD >/dev/null 2>&1"
) == 0 )

 # If you want to allow non-ascii filenames set this variable to true.
 my $allownonascii=`git config hooks.allownonascii`;
+chomp $allownonascii;

 # Cross platform projects tend to avoid non-ascii filenames; prevent
 # them from being added to the repository. We exploit the fact that the</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>