PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.49k stars 580 forks source link

isort gets confused when working with git worktrees #2068

Open mknaranja opened 1 year ago

mknaranja commented 1 year ago

If I work with git worktrees, isort (in the pre-commit hook) gets confused and identifies first party library code in the worktree as third party library.

I use

- repo: https://github.com/PyCQA/isort
  rev: 5.10.1
  hooks:
    - id: isort
      name: isort

What I do is:

git clone REPOSITORY.git
cd REPOSITORY
git worktree add ../REPOSITORY_WORKTREE BRANCH_WORKTREE
cd ../REPOSITORY_WORKTREE
pre-commit run --all

What it then does from:

import THIRDPARTY

import OWNCODE

when I run pre-commit run --all is:

import OWNCODE
import THIRDPARTY

or

import THIRDPARTY
import OWNCODE
mknaranja commented 1 year ago

Any ideas on that?