Skip to content

Commit e3ba14e

Browse files
committed
fix: get target branch from .gitmodules if specified
1 parent d6afbb6 commit e3ba14e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

client/src/addon_manager/models/addon.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,20 @@ export class Addon {
127127
}
128128

129129
public async getDefaultBranch() {
130-
const modulePath = vscode.Uri.joinPath(this.uri, "module");
130+
// Get branch from .gitmodules if specified
131+
const targetBranch = await git.raw(
132+
"config",
133+
"-f",
134+
".gitmodules",
135+
"--get",
136+
`submodule.addons/${this.name}/module.branch`
137+
);
138+
if (targetBranch) {
139+
return targetBranch;
140+
}
131141

142+
// Fetch default branch from remote
143+
const modulePath = vscode.Uri.joinPath(this.uri, "module");
132144
const result = (await git
133145
.cwd({ path: modulePath.fsPath, root: false })
134146
.remote(["show", "origin"])) as string;

0 commit comments

Comments
 (0)