File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -228,8 +228,31 @@ configs:
228228
229229 # Commit the initial Labspace project to the git repo
230230 cd /home/coder/project
231- echo ".labspace" >> .gitignore
232- echo "labspace.yaml" >> .gitignore
231+
232+ # Ensure .gitignore exists
233+ touch .gitignore
234+
235+ # Function to safely append to gitignore
236+ add_to_gitignore() {
237+ local entry="$$1"
238+
239+ # Skip if entry already exists
240+ if grep -qxF "$$entry" .gitignore 2>/dev/null; then
241+ return
242+ fi
243+
244+ # Ensure file ends with newline before appending (sed adds it if missing)
245+ sed -i -e '$$a\' .gitignore 2>/dev/null || true
246+
247+ # Now append the entry
248+ echo "$$entry" >> .gitignore
249+ }
250+
251+ # Add entries to gitignore
252+ add_to_gitignore ".labspace"
253+ add_to_gitignore "labspace.yaml"
254+ add_to_gitignore ".github/"
255+
233256 rm -rf .git
234257 git init
235258 git remote add origin [email protected] :moby/demo-app.git
You can’t perform that action at this time.
0 commit comments