fix(git): Löschen-Commit mit -z, G01 beim Löschen mit eigenem Text (Review PR #24)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69cfb364ae
commit
b59a5627e0
4 files changed
+25
-4
No files matched your search
@@ -482,7 +482,7 @@ export const createGitService = ({ cfg, getStorage, api, splitTextStyleAndMetada
|
||||
} catch (err) {
|
||||
release?.();
|
||||
if(!(err instanceof GitError)) { logGit('Löschen', err); err = new GitError('G05', 'Löschen im Repository fehlgeschlagen.'); } else if(err.HBErrorCode !== 'G01') logGit(`Löschen von ${brew.editId}`, err);
|
||||
res.status(err.status).json(err.toBody());
|
||||
res.status(err.status).json({ ...err.toBody(), operation: 'delete' });
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -177,8 +177,8 @@ export const createGitClient = (cfg, { lookup, gitBinary = 'git' } = {})=>{
|
||||
const buildDeleteCommit = async (repo, { parent, filePath, author, message, committer })=>{
|
||||
const extraEnv = { GIT_INDEX_FILE: repo.idx };
|
||||
await repo.run(['read-tree', parent], { extraEnv });
|
||||
// Modus 0 entfernt den Eintrag (--force-remove bräuchte eine Arbeitskopie)
|
||||
await repo.run(['update-index', '--index-info'], { extraEnv, input: `0 ${'0'.repeat(40)}\t${filePath}\n` });
|
||||
// Modus 0 entfernt den Eintrag (--force-remove bräuchte eine Arbeitskopie). -z: Pfad wird nicht C-quotiert gelesen.
|
||||
await repo.run(['update-index', '-z', '--index-info'], { extraEnv, input: `0 ${'0'.repeat(40)}\t${filePath}\0` });
|
||||
const tree = await repo.str(['write-tree'], { extraEnv });
|
||||
return commitTree(repo, { parent, tree, author, message, committer });
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user