Skip to content
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

account for special var workspaceFolder in Worktrees directory path #38

Open
mischadiehm opened this issue May 26, 2024 · 2 comments
Open

Comments

@mischadiehm
Copy link

It would be nice if the code respected the special var: ${workspacefolder}/ in the path so we can keep the worktrees local to the repos. What do you think?

image

I'm not a ts code programmer. This was generated by chatgpt but sth like:

export const calculateNewWorktreePathNew = async (workspaceFolder, branch) => {
    try {
        // Resolve ${workspaceFolder} if present in the input path
        if (workspaceFolder.includes('${workspaceFolder}')) {
            const resolvedWorkspaceFolder = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
            if (resolvedWorkspaceFolder) {
                workspaceFolder = workspaceFolder.replace('${workspaceFolder}', resolvedWorkspaceFolder);
            } else {
                throw new Error('Workspace folder could not be resolved.');
            }
        }
        ...
@alexiszamanidis
Copy link
Owner

Hi @mischadiehm,

Could you please provide details on how you currently use ${workspaceFolder}, the issues you are encountering with this setup, and specific examples of how you would like it to work in the desired implementation? Any additional insights into your workflow and needs would be helpful.

@mischadiehm
Copy link
Author

Hi @alexiszamanidis,

sorry for the late reply i got distracted and went back to git stash for a while. Giving this a new try. The idea is to not keep all worktrees for all repos in a central place with:

"vsCodeGitWorktrees.worktrees.dir.path": "/home/mischa/git/worktrees",

because of naming conflicts within the global namespace (what if two repos are called the same: e.g. examples) and because one might want to keep the worktrees closer to the projects folder. So my thought was to have a worktree whithin the repo itself under eg. $GITREPO/.worktree/ and have .worktree be part of the gitignore. Of course this might not always be the best Option...

What are your thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants