memory-leaks

Still reachable: lots of words in many pages.
git clone https://git.kevinlegouguec.net/memory-leaks
Log | Files | Refs | README | LICENSE

commit f39b75f20ec009976f58d66d1f376bc26911eb0d
parent f853096ac0246a493cda7dfd07eaaf58ed9f4e90
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Tue, 13 Mar 2018 07:17:19 +0100

Fix word-counting script

Magit uses --literal-pathspecs when  committing, so ls-files failed to
expand '*.md' in the word-counting script.

For a  wild ride, I  recommend going through  Git's get_global_magic()
function in pathspec.c, which juggles with…

- GIT_FOO_PATHSPECS environment variables;
- --foo-pathspecs CLI arguments;
- ":(foo)" magic suffixes;

… where foo can be "literal", "glob", "noglob", or "icase".

Diffstat:
Mindex.md | 3++-
Mupdate-count.sh | 9++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/index.md b/index.md @@ -1,5 +1,6 @@ # Peniblec's Memory Leaks -## still reachable: 0 words in 0 pages +## possibly lost: 530 words in 1 pages +## still reachable: 240 words in 1 pages Hi! I am a software engineer interested in [a bunch of things]. diff --git a/update-count.sh b/update-count.sh @@ -1,5 +1,10 @@ #!/bin/bash +list-committed () +{ + GIT_LITERAL_PATHSPECS='' git ls-files '*.md' +} + count-leaks () { let pages=0 @@ -14,7 +19,9 @@ count-leaks () echo ${words} ${pages} } -read words pages < <(git ls-files '*.md' | count-leaks) + + +read words pages < <(list-committed | count-leaks) pattern="\([0-9]*\) words in \([0-9]*\) pages" actual="${words} words in ${pages} pages"