Skip to content

sdk.ide.Diff() returns nothing even when git diff --cached does #1285

Closed as not planned

Description

@cristoslc

Before submitting your bug report

Relevant environment info

- OS:macOS 14.5
- Continue: v0.8.27
- IDE: VSCode 1.89.1

Description

tried implementing the example from https://docs.continue.dev/customization/slash-commands#custom-slash-commands-1 and it keeps returning a null diff, even when I have staged changes. I put together https://gist.github.com/cristoslc/0d9a555f3aab9d27ca6f2e3e60294d64 which tries git diff --cached, and that's returning what I expect when I have staged files.

To reproduce

  1. Implement https://docs.continue.dev/customization/slash-commands#custom-slash-commands-1 in your config.ts
  2. run custom slash command
    EXPECTED: Commit message summarizing diff
    ACTUAL: Response indicating LLM did not receive any diff

WORKAROUND: https://gist.github.com/cristoslc/0d9a555f3aab9d27ca6f2e3e60294d64
Workaround uses git diff --cached in the project folder and works as expected.

Log output

[Extension Host]% {text: 'const { exec } = require("child_process");\nconst {…rn config;\n}\n\nmodule.exports = { modifyConfig };\n'}
console.ts:137 [Extension Host]% {text: 'export function modifyConfig(config: Config): Conf…ssage;\n      }\n    },\n  });\n  return config;\n}\n\n\n'}
console.ts:137

Activity

  1. cristoslc commented on May 15, 2024

    @cristoslc
    Author
  2. changed the title [-]sdk.ide.Diff() returns nothing even when `git diff --cached` does[/-] [+]`sdk.ide.Diff()` returns nothing even when `git diff --cached` does[/+] on May 15, 2024
  3. sestinj commented on May 15, 2024

    @sestinj
    Contributor
  4. sestinj commented on May 15, 2024

    @sestinj
    Contributor

    So it seems like this cache parameter actually is a "staged or not staged" parameter after having tested it a bunch. I'm weary of this, probably there's some reason something staged would be cached, but haven't found the behavior to be otherwise yet. So this commit is my solution for now, but I'm going to keep my eye on it. The thing to look for at this point would be duplication

    b5052a3

  5. mltsy commented on Jun 3, 2024

    @mltsy

    I noticed this problem myself, just trying to use @Git Diff summarize this commit for me in the chat panel. I assume it's the same problem, because all of the files in the commit were new, and staged to be committed. Because they're all new (untracked) files, even running git diff from the terminal shows no diff. If I stage them (adding them to the index), then git diff also shows no changes, because they're already staged. I think what would be nice is for @Git Diff to use git diff --cached to just look at the staged changes (that way I can control exactly what I want it to summarize for me).

    If I should open a separate ticket for this, let me know. It looks like your proposed solution is to include staged and unstaged changes in the context, which would also be fine I suppose. It still doesn't include untracked files, and doesn't allow as much control (in terms of what changes are being included), but it would work well for 90% of cases.

  6. added
    area:slash-commands
    kind:bug
    ide:vscode
    and removed on Jul 8, 2024
  7. github-actions commented on Mar 3, 2025

    @github-actions
    Contributor

    This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue.

  8. mltsy commented on Mar 3, 2025

    @mltsy

    This appears to work in v1.0.1! 🎉 If you stage some changes, they show up in @Git Diff. If you have changes staged AND unstaged changes, you will get two change sets, which could be confusing to continue.dev, but... it's also confusing to a human, so nothing unique there. There might be a way to improve on that (like split @Git diff into @Git Staged and @Git Unstaged) but that could be controversial so I think the original scope of this ticket can be considered resolved!

  9. added
    os:mac
    on May 7, 2025
  10. github-actions commented on Aug 6, 2025

    @github-actions
    Contributor

    This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue.

  11. github-actions commented on Aug 17, 2025

    @github-actions
    Contributor

    This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!

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

    area:slash-commandside:vscodekind:bugos:macstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions