git-update-infoplist

git-update-infoplist is a small utility that allows you to embed Git’s commit ID in your project’s Info.plist (or any other plist file).

git-update-infoplist accepts two arguments - a path to the Git repository followed by a path to the plist to which the commit ID will be written. It’ll then try to locate git-log1, and use it to get the commit ID of the repository’s head. The commit ID is then written back to the plist2 so you can use it at later in your app.

1 The git-log executable is searched in the standard path and in /usr/local/bin, /usr/local/sbin, /opt/local/bin and /opt/local/sbin. If git-log is installed in another directory, use the GIT_LOG_PATH environment variable to point git-update-infoplist to it.

2 The default key for the commit ID is DPGitCommit. You can customize it by setting the COMMIT_KEY_NAME environment variable to your custom key.

Download a compiled universal binary or take a look at the code.

Changelog

  • v0.3
    • We now check the contents of the repository directory for a git repo layout.
    • The passed paths are now standardized before using.
    • Paths relative to the current directory are now valid.
    • Added -[NSString absolutePath].
    • Added +[NSTask fullPathToExecutable:additionalSearchPaths:].
    • A help is now displayed if no arguments are available, or if ‘-h’ or ‘–help’ were passed.
  • v0.2
    • Rewrote +[NSTask fullPathToExecutable:] with pure Cocoa.
    • Added custom executable paths.
  • v0.1
    • Initial release