Add option to render part of the diff (without the header)
When
{{ gitDiff package.yaml }}
Now:
diff --git a/package.yaml b/package.yaml
index 2d9a1e9..37b4b54 100644
--- a/package.yaml
+++ b/package.yaml
@@ -14,6 +14,7 @@ description: Please see the README on GitHub at
dependencies:
- base >= 4.7 && < 5
+- aeson
library:
source-dirs: src
What I hope to have
dependencies:
- base >= 4.7 && < 5
+- aeson
library:
source-dirs: src
This could be some sort of option that you have to turn on so that the project stays backward compatible.
Happy to help, please point me to places :)
Ha! Something that annoyed me as well - in fact https://stackoverflow.com/questions/47496283/how-do-i-exclude-the-patch-header-with-git-diff!
In terms of actually "fixing" this though, I'm wondering if it's not better to somehow configure a "diff tool" for git using something like git config --global diff.external ... - whether perhaps we can pass this as a parameter or point the user to configure this?
If you want to work around this quickly for now though you could maybe use {{{{ shellOutput ./gitDiffCustom.sh filepath/xyz.txt }}}?
I have
{{{{ shellOutput git diff HEAD^ HEAD src/EncodePanda/Lens2.hs | sed -e '1,6d' | sed '/^@/d' | sed '/\[-- end snippet\]/d' }}}}
but that only worked till I add next commit is there some way to reference the beginning and end tag?
I've managed to make it work with gch-end-2 gch-begin-3 but I'm thinking of it a temp solution. Would love to contribute to the project adding this as an option to diff
I think your concern with using the gch-end-*/ghc-begin-* is the hardcoded chapter numbers - if it's something different let me know. In which case possibly a solution would be to reference the current chapter number (this is yet to be implemented) via a shell variable.
For example: ghc-begin-$CHAPTER_INDEX