Skip to content

Commit 7f61e39

Browse files
authored
Merge pull request #20 from odefun/ode_1770285236.294269
chore: enable worktree config and bump version
2 parents 87d4caa + e6d3a31 commit 7f61e39

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ode",
3-
"version": "0.0.29",
3+
"version": "0.0.30",
44
"description": "Ode - OpenCode chat controller for Slack",
55
"module": "packages/core/index.ts",
66
"type": "module",

packages/ims/slack/client.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,9 +1434,15 @@ async function handleUserMessageInternal(
14341434
["user.name", githubInfo?.gitName],
14351435
["user.email", githubInfo?.gitEmail],
14361436
];
1437+
log.info("Setting git identity in worktree config", {
1438+
channelId,
1439+
threadId,
1440+
hasName: Boolean(githubInfo?.gitName),
1441+
hasEmail: Boolean(githubInfo?.gitEmail),
1442+
});
14371443
for (const [key, value] of updates) {
14381444
if (!value) continue;
1439-
const result = spawnSync("git", ["config", "--local", key, value], {
1445+
const result = spawnSync("git", ["config", "--worktree", key, value], {
14401446
cwd,
14411447
env: { ...process.env },
14421448
encoding: "utf-8",

packages/utils/worktree.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ function ensureWorktreeGitignore(repoRoot: string): void {
108108
writeFileSync(gitignorePath, `${contents}${suffix}${entry}\n`);
109109
}
110110

111+
function ensureWorktreeConfig(repoRoot: string, env?: Record<string, string>): void {
112+
try {
113+
const output = runGit(["config", "--bool", "--get", "extensions.worktreeConfig"], repoRoot, env).trim();
114+
if (output === "true") return;
115+
} catch {
116+
// Fall through to enable.
117+
}
118+
119+
runGit(["config", "extensions.worktreeConfig", "true"], repoRoot, env);
120+
}
121+
111122
export async function ensureSessionWorktree(params: {
112123
cwd: string;
113124
worktreeId: string;
@@ -120,6 +131,7 @@ export async function ensureSessionWorktree(params: {
120131
}
121132

122133
ensureWorktreeGitignore(repoRoot);
134+
ensureWorktreeConfig(repoRoot, env);
123135

124136
const worktreeDir = join(repoRoot, ".worktree");
125137
const worktreePath = join(worktreeDir, worktreeId);

0 commit comments

Comments
 (0)