Skip to content

"--ig" argument leads to git diff error #115

Closed

Description

@gmonceyron

Hi,

I encounter a git diff error when I run the following command using diff2html-cli :

diff2html -F my-pretty-diff.html --hwt ci/mail-template.html --ig ci -- --no-prefix -U1000 -M HEAD~1

I get this error :

Error: Command failed: git diff "--no-prefix" "-U1000" "-M" "HEAD~1" --no-color ":(exclude)ci"
fatal: ambiguous argument ':(exclude)ci': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

    at checkExecSyncError (node:child_process:681:11)
    at Object.execSync (node:child_process:718:15)
    at Object.execute (/usr/local/lib/node_modules/diff2html-cli/lib/utils.js:38:36)
    at runGitDiff (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:87:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:125:32)
    at step (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:63:23)
    at Object.next (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:44:53)
    at /usr/local/lib/node_modules/diff2html-cli/lib/cli.js:38:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:34:12) {
  status: 128,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 66 61 74 61 6c 3a 20 61 6d 62 69 67 75 6f 75 73 20 61 72 67 75 6d 65 6e 74 20 27 3a 28 65 78 63 6c 75 64 65 29 63 69 27 3a 20 75 6e 6b 6e 6f 77 6e 20 ... 143 more bytes>
  ],
  pid: 140,
  stdout: <Buffer >,
  stderr: <Buffer 66 61 74 61 6c 3a 20 61 6d 62 69 67 75 6f 75 73 20 61 72 67 75 6d 65 6e 74 20 27 3a 28 65 78 63 6c 75 64 65 29 63 69 27 3a 20 75 6e 6b 6e 6f 77 6e 20 ... 143 more bytes>
} []

Am I doing something wrong ? What am I missing ?

Version details :

  • npm 7.5.1
  • node 15.8.0
  • diff2html 5.1.7

Activity

  1. rtfpessoa commented on Feb 20, 2021

    @rtfpessoa
    Owner

    Hi @gmonceyron,

    Seems like there is a conflict with the name ci and git cannot differentiate it from a branch or tag.
    I did a possible fix as suggested by then error message and released it in version 5.1.8-fixignorepathsusespawn.1.37dcf7e.
    Can you check if it is fixed and let me know?

  2. rtfpessoa commented on Feb 21, 2021

    @rtfpessoa
    Owner

    Let me know if it is not fixed and I will re-open

  3. gmonceyron commented on Feb 22, 2021

    @gmonceyron
    Author

    Hi @rtfpessoa,

    Thanks for investigating so promptly.
    I am not sure to understand this part :

    Seems like there is a conflict with the name ci and git cannot differentiate it from a branch or tag.

    I understood that the --ig flag was to use to exclude files/folders, not tags or branches.
    My filetree has evolved, it is not ci anymore I want to exclude, but .gitlab, I encounter the same issue.

    Thanks,
    Regards,
    Guillaume

  4. rtfpessoa commented on Feb 22, 2021

    @rtfpessoa
    Owner

    @gmonceyron that is weird, can you create/provide a repository where I can replicate the issue?

  5. gmonceyron commented on Feb 22, 2021

    @gmonceyron
    Author

    @rtfpessoa I just created a public Gitlab project to reproduce the same error using a similar gitlab-ci pipeline.
    You can see in the job logs the error I get.

  6. rtfpessoa commented on Feb 28, 2021

    @rtfpessoa
    Owner

    @gmonceyron I did not release a new version, seems like I forgot to click approve in the release 🤦
    Can you try again and log the version you are using with diff2html --version

  7. rtfpessoa commented on May 7, 2021

    @rtfpessoa
    Owner

    Let me know if the problem still occurs

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