1
2
3
4
5
6
7
8
9
10
11
12 package org.eclipse.jgit.pgm.debug;
13
14 import org.eclipse.jgit.dircache.DirCache;
15 import org.eclipse.jgit.pgm.Command;
16 import org.eclipse.jgit.pgm.TextBuiltin;
17 import org.eclipse.jgit.pgm.internal.CLIText;
18
19 @Command(usage = "usage_WriteDirCache")
20 class WriteDirCache extends TextBuiltin {
21
22 @Override
23 protected void run() throws Exception {
24 final DirCache cache = db.readDirCache();
25 if (!cache.lock())
26 throw die(CLIText.get().failedToLockIndex);
27 cache.read();
28 cache.write();
29 if (!cache.commit())
30 throw die(CLIText.get().failedToCommitIndex);
31 }
32 }