Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): refreshing a checked-out branch keeps trailing Unicode whitespace in its name #48254

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48254/headopened View on GitHub

Showing 2 changed files with 51 additions and 1 deletion.

x
0 of 2 viewed, 2 left
48 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -2234,6 +2234,54 @@
}).pipe(Effect.provide(layerTest)),
+​
+ it.effect("refreshes a checked-out branch with trailing Unicode whitespace", () =>
+ Effect.gen(function* () {
+ const { cwd, remoteHead } = yield* cloneBehindRemote;
+ yield* git(cwd, ["fetch", "origin"]);
+ const originalHead = yield* git(cwd, ["rev-parse", "HEAD"]);
+ const unicodeBranch = "feature\u00A0";
+ yield* git(cwd, ["branch", "feature", originalHead]);
+ yield* git(cwd, ["switch", "-c", unicodeBranch, originalHead]);
+ const driver = yield* GitVcsDriver.GitVcsDriver;
+​
+ const movedByName = yield* driver.refreshCheckedOutBranch({
+ cwd,
+ branch: unicodeBranch,
+ targetCommit: remoteHead,
+ });
+ assert.deepStrictEqual(movedByName, {
+ headCommit: remoteHead,
+ moved: true,
+ onTarget: true,
+ });
+ assert.equal(yield* git(cwd, ["rev-parse", `refs/heads/${unicodeBranch}`]), remoteHead);
+​
+ const alreadyOnTarget = yield* driver.refreshCheckedOutBranch({
+ cwd,
+ branch: unicodeBranch,