Skip to content

Commit 0a145d8

Browse files
committed
refactor: extract git-rebase-todo filename
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 85ccd10 commit 0a145d8

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

apply.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ const filenameOfNeedsToApply = "needs-to-apply" as const;
105105
const getPathOfFilenameOfNeedsToApply = (pathToStackedRebaseDirInsideDotGit: string): string =>
106106
path.join(pathToStackedRebaseDirInsideDotGit, filenameOfNeedsToApply);
107107

108+
/**
109+
* TODO rename "markThatApplied" because we are _not_ reversing the action
110+
* (undo-ing the file rename),
111+
* we are invoking a new action of removing the files.
112+
*/
108113
export const unmarkThatNeedsToApply = (
109114
pathToStackedRebaseDirInsideDotGit: string,
110115
mark = getPathOfFilenameOfNeedsToApply(pathToStackedRebaseDirInsideDotGit),

filenames.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
export const filenames = {
55
rewrittenList: "rewritten-list",
66
rewrittenListApplied: "rewritten-list.applied",
7+
//
8+
gitRebaseTodo: "git-rebase-todo",
9+
//
10+
711
/**
812
* TODO extract others into here
913
*/

git-stacked-rebase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ export const gitStackedRebase = async (
122122
const dotGitDirPath: string = repo.path();
123123

124124
const pathToRegularRebaseDirInsideDotGit: string = path.join(dotGitDirPath, "rebase-merge");
125-
const pathToRegularRebaseTodoFile = path.join(pathToRegularRebaseDirInsideDotGit, "git-rebase-todo");
125+
const pathToRegularRebaseTodoFile = path.join(pathToRegularRebaseDirInsideDotGit, filenames.gitRebaseTodo);
126126

127127
const createPathForStackedRebase = (withName: string): string => path.join(dotGitDirPath, withName); // "stacked-rebase"
128128

129129
const __default__pathToStackedRebaseDirInsideDotGit: string = createPathForStackedRebase("stacked-rebase");
130130
const __default__pathToStackedRebaseTodoFile = path.join(
131131
__default__pathToStackedRebaseDirInsideDotGit,
132-
"git-rebase-todo"
132+
filenames.gitRebaseTodo
133133
);
134134

135135
let parsed: {
@@ -146,7 +146,7 @@ export const gitStackedRebase = async (
146146

147147
parsed = {
148148
pathToStackedRebaseDirInsideDotGit: insideDir,
149-
pathToStackedRebaseTodoFile: path.join(insideDir, "git-rebase-todo"),
149+
pathToStackedRebaseTodoFile: path.join(insideDir, filenames.gitRebaseTodo),
150150
};
151151
} else {
152152
parsed = {

0 commit comments

Comments
 (0)