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
Git: Add a substitution variable for the current git repository #30378
Comments
Where would you use it in? |
In the browse and include paths used by the cpp plugin - assuming it would be available... |
OK, wouldn't the current workspace path be enough for you? |
No - unfortunately our code base is large, so I have multiple workspaces within the same repo. The browse and includes paths have several entries which are outside the workspace, but within the git repo. Relative paths don't always work because some workspaces are at different levels within the repo. The repo can also be checked out in any other folder. So the one thing that is consistent between them all is the root of the repository. |
Also want this feature. I want to set environment variable for |
@joaomoreno Isn't this already be a variable in vscode? Can we access it in variable substitution? |
@joaomoreno, I'm second to @Thaina question. Maybe |
@Thaina You can actually do this for the tasks.json file. You can add
The cool thing I found out today is that you can do something like:
which will set |
@Gruntfuggly I suspect that it only be accessed in command which will execute that. If I access environment variable directly in the code would it be the branch name or that git command text? |
@Thaina I currently do:
Which finds the root folder of the git repo and exectutes the env.sh script in the right place, but also the qmake has access to the WORKSPACE variable and is used to pull in other files. I've realised I put the quotes in the wrong place in my first example (fixed now). |
@joaomoreno Really, can we have a command that just return that Shouldn't it as easy as commands.registerCommand('git.branch', () => $(git-branch)); {
"GIT_BRANCH" : "${command:git.branch}"
} ? |
Since you can have multiple git repositories open, what would you expect in that case? |
@joaomoreno It should be the git repo of the project itself when it running or debugging |
We can implement it as a command. But commands don't have any context... So it would not know which repository you'd mean. |
@joaomoreno OK but then what would happen in this line of code? |
That is an icon. |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
Still not possible? |
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
The equivalent of:
$(git rev-parse --show-toplevel 2>/dev/null)
would be really useful...
The text was updated successfully, but these errors were encountered: