Bug fixes on git

This commit is contained in:
Richard Osborne
2026-02-18 21:03:36 +01:00
parent ade2afee85
commit 2990e47059
5 changed files with 75 additions and 7 deletions

View File

@@ -1,7 +1,8 @@
export * from './componentconnections';
export * from './componentinstances';
export * from './componentports';
export * from './componentspanel';
// componentspanel test removed - tests legacy Backbone ComponentsPanelView which
// has been archived to ComponentsPanelNew/ComponentsPanel.ts.legacy (not webpack-resolvable)
export * from './conditionalports';
export * from './dynamicports';
export * from './expandedports';

View File

@@ -1,3 +1,4 @@
export * from './UBAConditions.test';
export * from './UBASchemaParser.test';
export * from './ElementConfigRegistry.test';
// NOTE: UBAConditions.test, UBASchemaParser.test, ElementConfigRegistry.test
// use @jest/globals and are Jest-only tests. They run via `npm run test:editor`.
// Do NOT re-add them here - the Electron Jasmine runner will crash on import.
export {};

View File

@@ -1 +1,4 @@
export * from './StyleAnalyzer.test';
// NOTE: StyleAnalyzer.test uses @jest/globals and is a Jest-only test.
// It runs via `npm run test:editor`.
// Do NOT re-add it here - the Electron Jasmine runner will crash on import.
export {};

View File

@@ -265,6 +265,15 @@ export class Git {
// this will also checkout the branch
await popStashEntryToBranch(this.baseDir, stash.name, stashBranchName);
// Commit the stash contents to the stash branch to clean the working tree.
// Without this, git refuses to merge when both branches have modifications to the
// same file (e.g. .gitignore added by appendGitIgnore in _setupRepository).
const stashBranchStatus = await this.status();
if (stashBranchStatus.length > 0) {
await addAll(this.baseDir);
await createCommit(this.baseDir, 'Stash contents');
}
// Merge our working branch into the stash branch
await this._merge({
theirsBranchName: previousBranch,
@@ -377,6 +386,35 @@ export class Git {
await cleanUntrackedFiles(this.baseDir);
}
/**
* Fetch remote changes and merge them into the current branch using Noodl's
* custom merge strategy (handles project.json conflicts).
*
* Equivalent to `git fetch` + `git merge origin/<currentBranch>`.
*/
async pull(options: PullOptions = {}): Promise<void> {
// 1. Fetch latest remote state
await this.fetch({ onProgress: options.onProgress });
// 2. Nothing to merge if remote has no commits yet
const remoteHeadId = await this.getRemoteHeadCommitId();
if (!remoteHeadId) {
return;
}
// 3. Merge origin/<currentBranch> into current branch
const currentBranch = await this.getCurrentBranchName();
const remoteName = await this.getRemoteName();
const remoteRef = `${remoteName}/${currentBranch}`;
await this._mergeToCurrentBranch({
theirsBranchName: remoteRef,
squash: false,
message: `Merge ${remoteRef} into ${currentBranch}`,
allowFastForward: true
});
}
/**
*
* @deprecated This is only used in old git panel
@@ -621,8 +659,6 @@ export class Git {
try {
await this.checkoutBranch(branchName);
} catch (err) {
throw err;
} finally {
if (needsStash) {
await this.stashPopChanges(currentBranchName);