|
| 1 | +# ATTN: This file is 2x the same code (assumeUnchanged & skipWorktree) |
| 2 | + |
| 3 | + |
1 | 4 | ##############################################################################
|
2 | 5 | #.SYNOPSIS
|
3 | 6 | # `git update-index --assume-unchanged` the indexes passed as $args in the working directory
|
@@ -39,5 +42,63 @@ function Git-ListAssumed {
|
39 | 42 | ##############################################################################
|
40 | 43 | function Git-NumberedUnassumed {
|
41 | 44 | $file = $global:assumedFiles[$args]
|
| 45 | + if (-not $file) { |
| 46 | + Write-Host "Couldn't find hidden file with index $args" |
| 47 | + } |
42 | 48 | git update-index --no-assume-unchanged $file
|
43 | 49 | }
|
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +############################################################################## |
| 60 | +#.SYNOPSIS |
| 61 | +# `git update-index --skip-worktree` the indexes passed as $args in the working directory |
| 62 | +############################################################################## |
| 63 | +function Git-NumberedHidden { |
| 64 | + $fileInfos = Parse-GitIndexes $args 'workingDir' |
| 65 | + if (-not $fileInfos) { |
| 66 | + return |
| 67 | + } |
| 68 | + |
| 69 | + $files = $fileInfos | % {$_.fullPath} |
| 70 | + git update-index --skip-worktree $files |
| 71 | +} |
| 72 | + |
| 73 | + |
| 74 | +# To Unhide we need to list the hidden files first |
| 75 | + |
| 76 | +$global:hiddenFiles = @() |
| 77 | + |
| 78 | + |
| 79 | +############################################################################## |
| 80 | +#.SYNOPSIS |
| 81 | +# Displays all currently git skip worktree files with indexes to be used by Git-NumberedHidden |
| 82 | +############################################################################## |
| 83 | +function Git-ListHidden { |
| 84 | + $files = (git ls-files -v) | Where-Object { $_.StartsWith("S") } | % { $_.Substring(2) } |
| 85 | + $index = 0 |
| 86 | + $files | % { |
| 87 | + Write-Host "$index $_" |
| 88 | + $global:hiddenFiles += $_ |
| 89 | + $index++ |
| 90 | + } |
| 91 | +} |
| 92 | + |
| 93 | + |
| 94 | +############################################################################## |
| 95 | +#.SYNOPSIS |
| 96 | +# Git unhides a single index passed as $args as displayed by Git-ListHidden |
| 97 | +############################################################################## |
| 98 | +function Git-NumberedUnhidden { |
| 99 | + $file = $global:hiddenFiles[$args] |
| 100 | + if (-not $file) { |
| 101 | + Write-Host "Couldn't find hidden file with index $args" |
| 102 | + } |
| 103 | + git update-index --no-skip-worktree $file |
| 104 | +} |
0 commit comments