Skip to content
  • Dominik Haumann's avatar
    Projects plugin: fix git file listing for umlauts such as äöü · a5923791
    Dominik Haumann authored
    Summary:
    git ls-files avoids umlauts or unicode surrogate characters.
    The problem is that `git ls-files` outputs:
    
      $ git ls-files | grep Der
      "Der B\303\244cker/L\303\266ffler.txt"
      DerBaecker/Loeffler.txt
    
    instead of "Der Bäcker\Löffler.txt".
    It uses quotes and unicode escape sequences to avoid the ä and ö.
    
    This patch uses `git ls-files -z` for listing the contents. Instead
    of \r\n, the file listing the dumps a bytearray that is \0 separated
    for each entry.
    
    In the -z mode, no unicode escaping is done, and the umlauts such
    as äöü or any other unicode characters are displayed correctly.
    
    There is still room for improvement, since readAllStandardOutput()
    might return a very large listing, which allocates a lot of memory.
    Therefore, a buffered solution (using a lambda or so) would probably
    be better. This, however, can be done in a separate patch.
    
    BUG: 389415
    
    Test Plan: make test
    
    Reviewers: cullmann, gregormi, ngraham, brauch
    
    Reviewed By: cullmann, brauch
    
    Subscribers: brauch, #kate
    
    Tags: #kate
    
    Differential Revision: https://phabricator.kde.org/D10311
    a5923791