Skip to content

Instantly share code, notes, and snippets.

@tseaver
Created May 28, 2013 18:11
Show Gist options
  • Save tseaver/5664821 to your computer and use it in GitHub Desktop.
Save tseaver/5664821 to your computer and use it in GitHub Desktop.
Git pre-commit hook to generate / update distutils' MANIFEST.in file using 'git ls-files'.
#!/bin/sh
#=============================================================================
# Generate distutils' MANIFEST.in from the checked-in contents of a Git repo.
#
# Symlink this script into your Git clone as '.git/hooks/pre-commit'
# After that point, any commit will cause 'MANIFEST.in' to be generated in
# the root of the clone. The *second* commit will update the file to name
# itself (not a bug, just an oddity, as distutils includes MANIFEST.in if
# it is present, no matter what).
#=============================================================================
GIT=/usr/bin/git
cd `$GIT rev-parse --show-toplevel`
$GIT ls-files > MANIFEST.in
$GIT add MANIFEST.in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment