Skip to content

set the default remote to origin on addon install and when a module is getting added - #36

Closed
rpkoller wants to merge 3 commits into
amateescu:mainfrom
rpkoller:20260729-rpkoller-set-default-remote
Closed

set the default remote to origin on addon install and when a module is getting added#36
rpkoller wants to merge 3 commits into
amateescu:mainfrom
rpkoller:20260729-rpkoller-set-default-remote

Conversation

@rpkoller

Copy link
Copy Markdown
Contributor

The Issue

How This PR Solves The Issue

Within the install.yaml i've added an if statement that checks if checkout.defaultRemote is set for the Drupal core repo (most likely it is not). If that is the case it is setting it to origin to provide a fully qualified name and to avoid any problems with the switch command after a MR was added and checked out. When the addon is getting uninstalled that setting for the Drupal core repo is getting unset again in case the value is set to origin - but not completely certain about that step. in a previous iteration ive generally unset it on addon install now i changed it to only unset it in case the value is origin

for the add-module i've added the same condition, in case no defaultRemote is set it is getting set to origin. For the remove-module no unsetting is necessary cuz on module removal the repo is getting deleted.

and i've added a small section at the end of the installation section within the readme to inform the user about the behavior under the hood setting checkout.defaultRemote to origin and provided the command necessary to adjust that default setting to their own likes.

Manual Testing Instructions

ddev add-on get https://github.com/amateescu/ddev-drupal-dev/tarball/refs/pull/REPLACE_ME_WITH_THIS_PR_NUMBER/head
ddev restart

Automated Testing Overview

Release/Deployment Notes

Comment thread install.yaml Outdated
Comment thread install.yaml
# Create test output directory
- mkdir -p ../test_output
# Set checkout.defaultRemote to origin for Drupal core if not set yet
- if [ -z "$(git config --get checkout.defaultRemote)" ]; then git config set checkout.defaultRemote origin; echo "checkout.defaultRemote set to origin"; fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is if this means people might accidentally end up pushing to origin instead of a fork. Not sure how likely that is, and it would only be for those who have access.

@amateescu

Copy link
Copy Markdown
Owner

Posted an alternative approach in #37, which doesn't modify the git config automatically.

@amateescu amateescu closed this Jul 30, 2026
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

Successfully merging this pull request may close these issues.

Question about using the new command for switching branches

3 participants