Skip to content

Updating Recipe Fails When Using Git Sub-Modules #864

@PythooonUser

Description

@PythooonUser

Symfony version(s) affected

5.4.4

Description

Project Setup

We are using a project structure that leverages git sub-modules, i.e.

root
  -> project1
  -> project2 (checked-out)

The .git "folder" is actually a file thereof, pointing to the "parent" .git folder:

# cat root/project2/.git
gitdir: ../.git/modules/project2

Problem

When I now run the command to update a recipe (it doesn't matter which one it is), I'm greeted with this error:

user@computer:/root/project2$ composer recipes:update symfony/security-bundle
  Updating recipe for symfony/security-bundle...

There was an error applying the recipe update patch
Failed to create "./.git/objects/e9": mkdir(): Not a directory.

Update the recipe by re-installing the latest version with:
  composer recipes:install symfony/security-bundle --force -v

Issue: Composer tries to work with the .git folder as usual, not being aware of the concept about git sub-modules.

The provided solution here is to just nuke the existing code and "start fresh". That works of course, but could be "cleaner".

How to reproduce

I think the description says enough already, but:

  • Create a git repository
  • Add a sub-module with a Symfony project
  • Try to update a recipe

Possible Solution

Not sure about a solution here.

We would probably need to make composer aware about the git sub-module concept and make it follow the link to the "actual" .git folder.

But the provided solution to just "nuke" the existing code is also fine, when the above cannot be achieved easily.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions