2

Is there a way I can add Smarty PHP's libs folder to my open source GitHub project and have it auto-update when Smarty updates?

Jamesking56
  • 3,683
  • 5
  • 30
  • 61

3 Answers3

4

Consider managing dependencies via Composer, then include Smarty via Packagist reference.

This way you can either refer to the latest dev version, or to a specific one - the latter approach advised, in order not to fall into breaking issues.

moonwave99
  • 21,957
  • 3
  • 43
  • 64
  • 1
    That is a php-based dependency management, not related to Git (unlike what I describe in my answer below), which makes more sense in this context. +1 – VonC Dec 29 '12 at 23:11
0

No, because the only reference you can register in your GitHub repo would be a submodule one.
(as in "Using someone else's repo as a Git Submodule on GitHub")

And a submodule is all about referencing a fixed commit, not "the latest".

You could work with subtree merging, but:

  • the update would be done locally
  • that would duplicate the data (between Smarty initial repo and your own repo), pushed to GitHub.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
-1

You can use this repo which is a Git mirror of Smarty. You really don't want external libraries to automatically update.

What if the update has a bug or some other change which breaks your code? How do you roll back? How do you even know where to roll back to if updates happen automatically?

I would strongly recommend you avoid automatic updates and instead update manually if you know you need new features or bug fixes in Smarty.

Michael Mior
  • 28,107
  • 9
  • 89
  • 113
  • Two questions: Is there a way I can only have the files which are in `distribution/libs` And is there a git command I can do to update it manually if I wanted to? – Jamesking56 Dec 29 '12 at 22:24
  • Unless you want to set up your own mirror, you'll have to deal with cloning the entire repository. There is such a thing as a "shallow clone" in git, but this doesn't play nicely with submodules. To update manually, you just go into the submodule directory and update the repo to whatever commit you want. This will update `.gitmodules` in your main repo which you can commit. – Michael Mior Dec 29 '12 at 23:22