* Was der Arbeitsbaum gegenueber HEAD anders hat: Pfade und was mit ihnen ist. * * `-uall` nennt jede einzelne neue Datei statt nur ihr Verzeichnis; ohne das * waere ein neues Verzeichnis ein Eintrag und der Kopiervorgang muesste raten, * was darin steht.
()
| 110 | * was darin steht. |
| 111 | */ |
| 112 | async function workingTreeChanges() { |
| 113 | const { stdout } = await execFileAsync( |
| 114 | 'git', |
| 115 | ['status', '--porcelain=v1', '-uall', '-z'], |
| 116 | { cwd: ROOT, maxBuffer: 32 * 1024 * 1024 }, |
| 117 | ); |
| 118 | const entries = []; |
| 119 | const parts = stdout.split('\0'); |
| 120 | for (let i = 0; i < parts.length; i += 1) { |
| 121 | const entry = parts[i]; |
| 122 | if (entry.length < 4) { |
| 123 | continue; |
| 124 | } |
| 125 | const code = entry.slice(0, 2); |
| 126 | const path = entry.slice(3); |
| 127 | // Eine Umbenennung nennt zwei Pfade; der zweite folgt als eigener Eintrag. |
| 128 | if (code.startsWith('R') || code.startsWith('C')) { |
| 129 | const from = parts[i + 1]; |
| 130 | i += 1; |
| 131 | entries.push({ code, path, from, action: 'copy' }); |
| 132 | entries.push({ code, path: from, action: 'delete' }); |
| 133 | continue; |
| 134 | } |
| 135 | entries.push({ code, path, action: code.includes('D') ? 'delete' : 'copy' }); |
| 136 | } |
| 137 | return entries; |
| 138 | } |
| 139 | |
| 140 | async function main() { |
| 141 | const totalStarted = Date.now(); |