Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/timothycrosley/isort into i…
Browse files Browse the repository at this point in the history
…ssue/1769
  • Loading branch information
timothycrosley committed Jul 8, 2021
2 parents b444003 + f44b5a5 commit c36414d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,9 +4,11 @@ Changelog
NOTE: isort follows the [semver](https://semver.org/) versioning standard.
Find out more about isort's release policy [here](https://pycqa.github.io/isort/docs/major_releases/release_policy).

### 5.9.2
### 5.9.2 TBD
- Improved behavior of `isort --check --atomic` against Cython files.
- Fixed #1769: Future imports added below assignments when no other imports present.
- Fixed #1772: skip-gitignore will check files not in the git repository.
- Fixed #1762: in some cases when skip-gitignore is set, isort fails to skip any files.

### 5.9.1 June 21st 2021 [hotfix]
- Fixed #1758: projects with many files and skip_ignore set can lead to a command-line overload.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/options.md
Expand Up @@ -622,7 +622,7 @@ Force all imports to be sorted as a single section

## Force Grid Wrap

Force number of from imports (defaults to 2 when passed as CLI flag without value)to be grid wrapped regardless of line length. If 0 is passed in (the global default) only line length is considered.
Force number of from imports (defaults to 2 when passed as CLI flag without value) to be grid wrapped regardless of line length. If 0 is passed in (the global default) only line length is considered.

**Type:** Int
**Default:** `0`
Expand Down
2 changes: 1 addition & 1 deletion isort/main.py
Expand Up @@ -472,7 +472,7 @@ def _build_arg_parser() -> argparse.ArgumentParser:
const=2,
type=int,
dest="force_grid_wrap",
help="Force number of from imports (defaults to 2 when passed as CLI flag without value)"
help="Force number of from imports (defaults to 2 when passed as CLI flag without value) "
"to be grid wrapped regardless of line "
"length. If 0 is passed in (the global default) only line length is considered.",
)
Expand Down
10 changes: 9 additions & 1 deletion isort/settings.py
Expand Up @@ -548,7 +548,15 @@ def _check_folder_gitignore(self, folder: str) -> Optional[Path]:

git_folder = Path(topfolder_result.rstrip()).resolve()

files = [str(p) for p in Path(git_folder).rglob("*")]
files: List[str] = []
# don't check symlinks; either part of the repo and would be checked
# twice, or is external to the repo and git won't konw anything about it
for root, _dirs, git_files in os.walk(git_folder, followlinks=False):
for git_file in git_files:
git_path = os.path.join(root, git_file)
# followlinks only disables walking into linked dirs
if not os.path.islink(git_path):
files.append(git_path)
git_options = ["-C", str(git_folder), "-c", "core.quotePath="]
try:
ignored = subprocess.check_output( # nosec # skipcq: PYL-W1510
Expand Down

0 comments on commit c36414d

Please sign in to comment.