stackmuncher / stm_app

This software engineer profile builder turns your code into a detailed list of skills for an online directory of software developers.
https://stackmuncher.com
GNU Affero General Public License v3.0
22 stars 1 forks source link

Unicode file names in git-log are escaped #42

Open rimutaka opened 2 years ago

rimutaka commented 2 years ago

A file name with non-ascii chars get encoded and escaped in git-log making it impossible to parse. This purely git-log issue. The blobs can be accessed with no issues.

It's not clear how to convert the numbers back to UTF-8. E.g.

Resources

  1. https://git-scm.com/docs/git-log#Documentation/git-log.txt---encodingltencodinggt
  2. https://stackoverflow.com/questions/69817372/how-to-decode-escaped-file-names-in-git-log
  3. https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences
  4. https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath

Git log dump

commit a2ed0ef590f9b04d6e548a522a0be75053c2eb4a (HEAD -> master, origin/master, origin/HEAD)
Author: ymhome <60121246+184ym2@users.noreply.github.com>
Date:   Tue Mar 16 05:33:30 2021 +0900

    20210316

"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/.vs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/v16/.suo"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ/Aggregation.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ/Sort.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csproj"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/Program.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/bin/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.exe"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/bin/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.pdb"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csproj.CoreCompileInputs.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csprojAssemblyReference.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.exe"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.pdb"

commit a6674fc5ed1ad277ea1325386cacd58d82364057
Merge: 2a11501 fd1a5aa
Author: ymhome <60121246+184ym2@users.noreply.github.com>
Date:   Thu Mar 11 20:51:48 2021 +0900

    Merge branch 'master' of github.com:184ym2/til into master

commit 2a1150123979283b5d4f6048be04306f6c3a3a56
Author: ymhome <60121246+184ym2@users.noreply.github.com>
Date:   Thu Mar 11 20:48:46 2021 +0900

    20210311

"CsharpObject\343\201\256\350\244\207\350\243\275Sample/.vs/CsharpObject\343\201\256\350\244\207\350\243\275Sample/v16/.suo"
"CsharpObject\343\201\256\350\244\207\350\243\275Sample/CsharpObject\343\201\256\350\244\207\350\243\275Sample/obj/x86/Debug/CsharpObject\343\201\256\350\244\207\350\243\275Sample.csproj.CoreCompileInputs.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/.vs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/v16/.suo"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ/Evaluation.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ/Projection.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ/Sort.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csproj"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/Program.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/TeamList.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/bin/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.exe"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/bin/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.pdb"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csproj.CoreCompileInputs.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csproj.FileListAbsolute.txt"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.csprojAssemblyReference.cache"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.exe"
"LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs/obj/x86/Debug/LINQ\343\202\265\343\203\263\343\203\227\343\203\253.cs.pdb"
rimutaka commented 2 years ago

A possible solution can be to use https://docs.rs/combine/4.6.2/combine/parser/repeat/fn.escaped.html or https://github.com/Geal/nom

rimutaka commented 2 years ago

Git -z option removes the encoding, but that produces a very messy output that is even harder to parse.