drupal-contributions icon indicating copy to clipboard operation
drupal-contributions copied to clipboard

After 'lando rebuild -y' git status shows changes

Open pyrello opened this issue 4 years ago • 7 comments

Hello. I've been trying out this tool and I notice that when I go to the web directory after lando rebuild -y and run git status, that I am seeing the following output:

	modified:   composer.json
	modified:   composer.lock
	modified:   composer/Metapackage/CoreRecommended/composer.json
	modified:   composer/Metapackage/PinnedDevDependencies/composer.json

If you are careful with running your git commands you can avoid any issues, but it also makes it more likely that someone (me) is going to make a mistake by running git -am at some point.

I'm just wondering if it is possible to resolve this? Thanks!

pyrello avatar Feb 26 '21 14:02 pyrello

It's because Drush is added with Composer and composer run-script drupal-phpunit-upgrade is run: https://github.com/thinktandem/drupal-contributions/blob/9.x/.lando.yml#L16

See also #35.

I have created a PR (#41) which removes composer run-script drupal-phpunit-upgrade in Drupal 9, since it is not necessary. If you remove Drush, Git is back at the starting point.

To try it out, pull down and check out the PR :

$ git clone [email protected]:thinktandem/drupal-contributions.git && cd drupal-contributions
$ git fetch origin pull/41/head:testing_pr_41
$ git checkout testing_pr_41
$ lando rebuild -y

Remove Drush and see that Git status is unchanged:

$ cd web
$ composer remove drush/drush
[...]
$ git status
On branch 9.2.x
Your branch is up to date with 'origin/9.2.x'.

nothing to commit, working tree clean

gitressa avatar Apr 12 '21 16:04 gitressa

Although #41 was merged this still seems to be happening. I set up this project yesterday following the README instructions and still end up with those modifications --

 > git status
On branch 9.3.x
Your branch is up to date with 'origin/9.3.x'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   composer.json
        modified:   composer.lock
        modified:   composer/Metapackage/CoreRecommended/composer.json
        modified:   composer/Metapackage/PinnedDevDependencies/composer.json

cdubz avatar May 21 '21 15:05 cdubz

The composer run-script drupal-phpunit-upgrade command added a lot of extra changes in composer.json and composer.lock, and #41 took care of that bit.

However, you still need to remove Drush as outlined above, to get to a clean Git status.

gitressa avatar May 21 '21 18:05 gitressa

Got it. Thanks, @gitressa. That worked. 👍

cdubz avatar May 21 '21 19:05 cdubz

Sounds good @cdubz, feel free to also check out #35, where the Git issue might get figured out -- or perhaps in this issue?

It would be great if Drush could get added, without touching the four .json and .lock files, I wonder if that's possible?

gitressa avatar May 22 '21 10:05 gitressa

@pyrello @gitressa @cdubz I didn't test this, but maybe here: https://github.com/thinktandem/drupal-contributions/blob/9.x/.lando.yml#L14

we could:

    run:
      - cd /app/web && composer require drush/drush && composer install
      - git checkout composer.json composer.lock
      - mkdir -p private/browsertest_output
      - yarn install --non-interactive --cwd /app/web/core

i think drush would still work and the git tree would be clean, but I did not test it.

serundeputy avatar May 22 '21 12:05 serundeputy

I've recently opened a MR with your solution @serundeputy, testing here it looks like it fixes, it would be nice to have a review there. #58

murilohpucci avatar Apr 15 '22 15:04 murilohpucci