davidrjonas / composer-lock-diff

See what has changed after a composer update
MIT License
274 stars 18 forks source link

How to specify git ref (with filename)? #39

Closed Bilge closed 1 year ago

Bilge commented 1 year ago

How do you actually specify a git ref with/without filename? If I run composer-lock-diff --from develop I get:

Failed to find 'develop' with 'loadFile'; Candidate 'develop' does not look loadable from the fs or php stream wrappers

From the error message alone it would seem to imply only file names are supported, contrary to the documentation that insists git refs are supported but makes no attempt to explain how they should be specified, much less in the mixed mode where a ref and a filename are supposedly supported concurrently. The (presumed example) of HEAD:composer.lock gives a similar error message, so presumably this is not how to specify a ref and a file either. How do we do this?

davidrjonas commented 1 year ago

Thanks for the question. What you’ve written should work. The code checks for a colon and if it doesn’t find one it appends : and the path to composer.lock. https://github.com/davidrjonas/composer-lock-diff/blob/master/composer-lock-diff If git show doesn’t find that file at that ref it assumes what was given is not a git ref at all. So, does git show develop:composer.lock show you what you expect? (Possibly develop:./composer.lock. I’m on mobile right now so I cannot verify) if it does then perhaps there is a bug. If you can write a few steps to reproduce the problem that’d be helpful.

On Sep 9, 2022, at 1:32 PM, Bilge @.***> wrote:

 How do you actually specify a git ref with/without filename? If I run composer-lock-diff --from develop I get:

Failed to find 'develop' with 'loadFile'; Candidate 'develop' does not look loadable from the fs or php stream wrappers

From the error message alone it would seem to imply only file name are supported, contrary to the documentation that insists git refs are supported but makes no attempt to explain how they should be specified, much less in the mixed mode where a ref and a filename are supposedly supported concurrently. How do we do this?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

Bilge commented 1 year ago

The problem was I wasn't working in the git repository root directory. Documentation could be a little clearer, as could the error message, but everything is working fine 👌🏻 Thanks for this tool!