flex icon indicating copy to clipboard operation
flex copied to clipboard

Updating Recipe Fails When Project Located in Subfolder in Git Repository

Open Peukku opened this issue 2 years ago • 0 comments

Closes #918 and #864

Updating Recipe fails when symfony project is not in the root of git project. As a developer the most problematic thing is that it fails without any errors. Some files are just not updated.

There is a simple project with commands needed to reproduce to see what is happening before the fix: https://github.com/Peukku/symfony-flex-reproducer-918-project-root/

I think there are two reasons for this to happen:

  • $patchString is created with git diff in tmpPath, which has a temporary flat git repository (with no path prefix), but applied bit later in project context where path would be needed.
  • Location of .git directory is assumed to be in project root, when it actually is in git root level. (or in .git/modules/[subproject] when using git submodules). The blobs do get written, but in the wrong location.

This PR uses git binary to resolve location of .git folder and current relative path to be used as the prefix for git diff.

Peukku avatar Jul 13 '22 11:07 Peukku