-
Notifications
You must be signed in to change notification settings - Fork 1
feat(KNO-10034): create .knockbranch file when it does not exist #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(KNO-10034): create .knockbranch file when it does not exist #624
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good!
* | ||
* @returns the path to the project root directory | ||
*/ | ||
export const findProjectRoot = async (): Promise<string> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious on the heuristic of looking for the .gitignore
. I think it makes sense for when you're in your project and executing a command from a sub-folder but I wonder if it may have unintended consequences, or if we should place other limits, like only looking up N levels. Just feels like an early optimization but I'm not completely opposed to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I just updated findProjectRoot
to add an additional restriction: we’ll stop searching for .gitignore
when we find a .git
directory, since that is most likely the repository root.
0feff27
to
6ccacee
Compare
de49ee1
to
2363bcd
Compare
6ccacee
to
f04186a
Compare
4249415
to
54053d6
Compare
2575171
to
b349bb1
Compare
d7b680e
to
802bd75
Compare
54053d6
to
458225d
Compare
458225d
to
506c585
Compare
506c585
to
811cb3b
Compare
Merge activity
|
Description
This PR updates the
knock branch switch
command so that when a.knock_branch
file is not found, we prompt the user to create one automatically. We’ll look for an existing.gitignore
file and create the.knock_branch
file sibling to it. The directory containing.gitignore
is our best guess for the root of the user’s project.I also updated
knock branch exit
so that instead of deleting the.knock_branch
file, it writes an empty string to it. This feels less intrusive than constantly deleting and re-creating.knock_branch
.Tasks
KNO-10034
Loom demo
https://www.loom.com/share/aaa825700da144ab8f6ea08208870860?sid=455ace12-9bf9-4d68-8137-93a0c4f388fa