Skip to content

Commit 8819962

Browse files
committed
remove the dynamic "rewrittenList" filename - use static one
Signed-off-by: Kipras Melnikovas <[email protected]>
1 parent 02fcef4 commit 8819962

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

Diff for: branchSequencer.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import assert from "assert";
33

44
import Git from "nodegit";
55

6-
import { filenames } from "./filenames";
7-
86
import { createExecSyncInRepo } from "./util/execSyncInRepo";
97
import { Termination } from "./util/error";
108

@@ -54,7 +52,6 @@ export type BranchSequencerArgs = BranchSequencerArgsBase & {
5452
actionInsideEachCheckedOutBranch: ActionInsideEachCheckedOutBranch;
5553
delayMsBetweenCheckouts?: number;
5654
callbackAfterDone?: CallbackAfterDone;
57-
rewrittenListFile?: typeof filenames.rewrittenList;
5855
};
5956

6057
export type BranchSequencerBase = (args: BranchSequencerArgsBase) => Promise<void>;
@@ -70,18 +67,13 @@ export const branchSequencer: BranchSequencer = async ({
7067
// callbackBeforeBegin,
7168
actionInsideEachCheckedOutBranch,
7269
callbackAfterDone = (): void => {},
73-
rewrittenListFile = filenames.rewrittenList,
7470
gitCmd,
7571
}) => {
7672
if (!fs.existsSync(pathToStackedRebaseDirInsideDotGit)) {
7773
throw new Termination(`\n\nno stacked-rebase in progress? (nothing to ${rootLevelCommandName})\n\n`);
7874
}
7975

80-
const stackedRebaseCommandsNew: GoodCommand[] = parseNewGoodCommands(
81-
repo,
82-
pathToStackedRebaseTodoFile,
83-
rewrittenListFile
84-
);
76+
const stackedRebaseCommandsNew: GoodCommand[] = parseNewGoodCommands(repo, pathToStackedRebaseTodoFile);
8577

8678
// const remotes: Git.Remote[] = await repo.getRemotes();
8779
// const remote: Git.Remote | undefined = remotes.find((r) =>

Diff for: forcePush.ts

-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ export const forcePush: BranchSequencerBase = (argsBase) =>
3838
execSyncInRepo(`${argsBase.gitCmd} push --force`);
3939
},
4040
delayMsBetweenCheckouts: 0,
41-
rewrittenListFile: "rewritten-list.applied",
4241
});

Diff for: parse-todo-of-stacked-rebase/parseNewGoodCommands.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import { GoodCommand, stackedRebaseCommands } from "./validator";
1414

1515
export function parseNewGoodCommands(
1616
repo: Git.Repository,
17-
pathToStackedRebaseTodoFile: string, //
18-
rewrittenListFile: typeof filenames.rewrittenList | typeof filenames.rewrittenListApplied
17+
pathToStackedRebaseTodoFile: string //
1918
): GoodCommand[] {
2019
const oldGoodCommands: GoodCommand[] = parseTodoOfStackedRebase(pathToStackedRebaseTodoFile);
2120

2221
logGoodCmds(oldGoodCommands);
2322

24-
const pathOfRewrittenList: string = path.join(repo.path(), "stacked-rebase", rewrittenListFile);
23+
const pathOfRewrittenList: string = path.join(repo.path(), "stacked-rebase", filenames.rewrittenList);
2524
const rewrittenList: string = fs.readFileSync(pathOfRewrittenList, { encoding: "utf-8" });
2625
const rewrittenListLines: string[] = rewrittenList.split("\n").filter((line) => !!line);
2726

@@ -36,7 +35,7 @@ export function parseNewGoodCommands(
3635
const fromToSHA = line.split(" ");
3736
assert(
3837
fromToSHA.length === 2,
39-
`from and to SHAs, coming from ${rewrittenListFile}, are written properly (1 space total).`
38+
`from and to SHAs, coming from ${filenames.rewrittenList}, are written properly (1 space total).`
4039
);
4140

4241
const [oldSHA, newSHA] = fromToSHA;

0 commit comments

Comments
 (0)