← All tasks
javascriptlint-staged/lint-staged #990Not a task: not reproduced

error "Entry ... not uptodate" for new files not staged for commit (git add --intent-to-add)

envgap__lint-staged__lint-staged-990

01 / FAILURE SIGNATURE

As reported upstream

✖ error: Entry 'not-staged.php' not uptodate. Cannot merge.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
586466fa107f743de407c680c37297c4290b2872
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

lint-staged/lint-staged #990 · read the original issue
### Description



Lint-staged seems unable to stash aside *new* files *not staged for commit* (sic!).



Note that new files are typically "untracked files", but `git add --intent-to-add` (or `git add -N`) adds untracked files to the index (*without* staging them). This is useful, because it includes the new files when using `git add --patch`.



### Steps to reproduce



```console

$ touch staged.php not-staged.php

$ git status

// ...

Untracked files:

  (use "git add <file>..." to include in what will be committed)

        not-staged.php

        staged.php

$ git add --intent-to-add .

$ git status

// ...

Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)

  (use "git restore <file>..." to discard changes in working directory)

        new file:   not-staged.php

        new file:   staged.php

$ git add staged.php

// ...

Changes to be committed:

  (use "git restore --staged <file>..." to unstage)

        new file:   staged.php



Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)

  (use "git restore <file>..." to discard changes in working directory)

        new file:   not-staged.php

$ lint-staged

✖ error: Entry 'not-staged.php' not uptodate. Cannot merge.

  Cannot save the current worktree state

↓ Skipped because of previous git error. [SKIPPED]

↓

  ✖ lint-staged failed due to a git error. [SKIPPED]

↓

  ✖ lint-staged failed due to a git error. [SKIPPED]



  ✖ lint-staged failed due to a git error.

  Any lost modifications can be restored from a git stash:



    > git stash list

    stash@{0}: automatic lint-staged backup

    > git stash apply --index stash@{0}



```



### Debug Logs



<!--

Run `lint-staged` in debug mode using the command line flag `--debug`. You can

either modify your pre-commit script/command to include the flag or invoke

`lint-staged` manually(`./node_modules/.bin/lint-staged --debug`). Read more

about debug mode here -

https://github.com/okonet/lint-staged#command-line-flags.



NOTE: This requires `lint-staged` version >= `6.0.0`.

-->

<details>



<summary>expand to view</summary>



```

lint-staged --debug

Running lint-staged with the following config:

{

  '*.js': [

    'vue-cli-service lint --max-warnings 0'

  ],

  '*.ts': [

    'vue-cli-service lint --max-warnings 0'

  ],

  '*.json': [

    './.jsonlint.js'

  ],

  '*.vue': [

    'vue-cli-service lint --max-warnings 0'

  ],

  '*.php': './.phpcbf',

  'src/locales/*.json': [

    './.jsonlint.js -s'

  ]

}

[STARTED] Preparing...

[FAILED] error: Entry 'not-staged.php' not uptodate. Cannot merge.

[FAILED] Cannot save the current worktree state

[STARTED] Running tasks...

[SKIPPED] Skipped because of previous git error.

[STARTED] Applying modifications...

[SKIPPED]

[SKIPPED]   ✖ lint-staged failed due to a git error.

[STARTED] Cleaning up...

[SKIPPED]

[SKIPPED]   ✖ lint-staged failed due to a git error.



  ✖ lint-staged failed due to a git error.

  Any lost modifications can be restored from a git stash:



    > git stash list

    stash@{0}: automatic lint-staged backup

    > git stash apply --index stash@{0}

```



</details>



### Environment



<!-- Tell us about your development environment -->

- **OS:** Ubuntu 20.04 LTS via WSL2 on Windows 10

- **Node.js:** 14.17.1

- **`lint-staged`:** 11.0.0

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]