Skip to content

Commit 56011d7

Browse files
authored
Add git filter for selected lines in vscode config json (#332)
2 parents 57b5723 + dbc8b9f commit 56011d7

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode/settings.json filter=removeFullHomePath

.vscode/settings.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,15 @@
191191

192192
// Tell the ROS extension where to find the setup.bash
193193
// This also utilizes the COLCON_WS environment variable, which needs to be set
194-
"ros.rosSetupScript": "${env:COLCON_WS}/install/setup.bash",
195194
"ros.distro": "iron",
196195
"search.useIgnoreFiles": false,
196+
"python.autoComplete.extraPaths": [
197+
"/opt/ros/iron/lib/python3.10/site-packages"
198+
],
199+
"python.analysis.extraPaths": [
200+
"/opt/ros/iron/lib/python3.10/site-packages"
201+
],
202+
197203

198-
// DO NOT COMMIT THESE ABSOLUTE PYTHON PATHS:
199-
200204

201205
}

Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY : basler install install-no-root pip pre-commit format pull-all pull-init pull-repos pull-files fresh-libs remove-libs setup-libs rosdep status update update-no-root
1+
.PHONY : basler install install-no-root pip pre-commit install-git-filters format pull-all pull-init pull-repos pull-files fresh-libs remove-libs setup-libs rosdep status update update-no-root
22

33
HTTPS := ""
44
REPO:=$(dir $(abspath $(firstword $(MAKEFILE_LIST))))
@@ -19,6 +19,13 @@ pre-commit:
1919
# Install pre-commit hooks for all submodules that have a .pre-commit-config.yaml file
2020
pre-commit install
2121

22+
install-git-filters:
23+
# Install git filters
24+
# The vscode settings file gets updated by the ros extension and contains the full path to the current user's home directory.
25+
# We don't want to commit this path, so we use a git filter to remove it when git adds the file to the staging area.
26+
# This does not affect the file on disk, so vscode will still work as expected.
27+
git config filter.removeFullHomePath.clean "sed '/\/home.*\(install\|build\)/d'"
28+
2229
format:
2330
# Format all files in the repository
2431
pre-commit run --all-files
@@ -78,6 +85,6 @@ status:
7885
# Show status of all repositories
7986
vcs status . --nested
8087

81-
update: pull-all rosdep pip pre-commit
88+
update: pull-all rosdep pip install-git-filters pre-commit
8289

83-
update-no-root: pull-all pip pre-commit
90+
update-no-root: pull-all pip install-git-filters pre-commit

0 commit comments

Comments
 (0)