Last active
October 6, 2025 01:38
-
-
Save hymkor/ea1c3ad29628290cd1c340de12a09710 to your computer and use it in GitHub Desktop.
git にも jj にも登録していないファイルを列挙(.gitignore に含まれているものも表示する)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Set-PSDebug -Strict | |
| $saveEncode = $null | |
| if ([Console]::IsOutputRedirected) { | |
| $saveEncode = [System.Console]::OutputEncoding | |
| [System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8 | |
| } | |
| $gitfiles = @{} | |
| git ls-files | ForEach-Object { $gitfiles[ $_ ] = $true } | |
| function ls-r($path){ | |
| Get-ChildItem $path -Exclude ".jj",".git" | | |
| ForEach-Object { | |
| if ( $_.Mode -like "d*" ){ | |
| ls-r (join-path $path $_.Name) | |
| } elseif ( $_.Mode -notlike "l*" ){ | |
| Write-Output ` | |
| ((join-Path $path $_.Name) ` | |
| -Replace "^\.\\","" ` | |
| -Replace "\\","/") | |
| } | |
| } | |
| } | |
| ls-R "." | Where-Object { -not $gitfiles.ContainsKey($_) } | |
| if ( $saveEncode -ne $null ){ | |
| [System.Console]::OutputEncoding=$saveEncode | |
| } | |
| #gist https://gist.github.com/hymkor/ea1c3ad29628290cd1c340de12a09710 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment