Skip to content

Conversation

aaronhallaert
Copy link
Owner

No description provided.

@aaronhallaert aaronhallaert linked an issue Apr 1, 2023 that may be closed by this pull request
@aaronhallaert aaronhallaert force-pushed the ah/support_git_diff_flags branch from e122583 to bc1b23a Compare April 1, 2023 17:35
@aaronhallaert aaronhallaert added the enhancement New feature or request label Apr 1, 2023
@aaronhallaert aaronhallaert self-assigned this Apr 3, 2023
@mmirus
Copy link

mmirus commented Apr 3, 2023

Thanks for working on this, @aaronhallaert! Unfortunately, I wasn't able to get it working.

Take this command syntax, which I think corresponds to what's used by diff_commit_file:

git diff <prev commit hash>:<file path> <commit hash>:<file path>

On the command line, adding flags like this works:

git -c delta.side-by-side=false diff <prev commit hash>:<file path> <commit hash>:<file path>

I tried to replicate this with the new args, but was unable to:

    local telescope = require("telescope")
    telescope.setup({
      -- ...
      extensions = {
        advanced_git_search = {
          -- git_flags = { "-c", "delta.side-by-side=false" }, -- `git: 'delta.side-by-side=false' is not a git command. See 'git --help'.`
          -- git_flags = { "-c delta.side-by-side=false" }, -- `unknown option: -c delta.side-by-side=false`
          -- git_flags = { "-c delta.side-by-side=" }, -- same as above
          git_flags = { "-cdelta.side-by-side=false" }, -- same as above

          -- I also tried this to show it's not a delta thing:
          -- git_flags = { "-c", 'core.pager=""' }, -- `git: 'core.pager=""' is not a git command. See 'git --help'.`
        },
      },
    })
    -- INFO: seems we must load this extension *after* telescope setup runs:
    telescope.load_extension("advanced_git_search")

You can see the output I got next to each form I attempted.

I also tried git_diff_flags, just in case, but also had no luck with that.

Please let me know if I should try anything else!

@aaronhallaert aaronhallaert force-pushed the ah/support_git_diff_flags branch from bc1b23a to 65d9786 Compare April 3, 2023 16:59
@aaronhallaert
Copy link
Owner Author

aaronhallaert commented Apr 3, 2023

@mmirus Thanks for trying it out and giving me a specific example to test with. I inserted the provided flags in the wrong order 😅 Now it should work with this -- git_flags = { "-c", "delta.side-by-side=false" },. Let me know if you find any other bugs.
BTW: I force pushed, so you'll probably need to pull with rebase

@mmirus
Copy link

mmirus commented Apr 3, 2023

Awesome! It's working now.

One other thing I ran into: you must run the Telescope setup before loading the extension for the flags to take effect. It might be helpful to make that clear in the README.

Thank you for implementing this!

@aaronhallaert aaronhallaert force-pushed the ah/support_git_diff_flags branch from 65d9786 to 16f4de4 Compare April 3, 2023 21:52
@aaronhallaert aaronhallaert merged commit 500be1a into main Apr 3, 2023
@aaronhallaert aaronhallaert deleted the ah/support_git_diff_flags branch April 3, 2023 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can we customize the previewer commands?
2 participants