Skip to content

Add option to render part of the diff (without the header) #3

Open

Description

@EncodePanda

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 :)

Activity

  1. chrissound commented on Dec 30, 2019

    @chrissound
    Owner

    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 }}}?

  2. EncodePanda commented on Dec 15, 2020

    @EncodePanda
    Author

    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?

  3. EncodePanda commented on Dec 15, 2020

    @EncodePanda
    Author

    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

  4. chrissound commented on Dec 15, 2020

    @chrissound
    Owner

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions