Created
March 8, 2011 18:36
-
-
Save bdrewery/860736 to your computer and use it in GitHub Desktop.
Takes a git repo with expected branches 'base' and 'master' and produces a patch for /usr/src/files/path-REPO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| DEST_DIR=$(realpath $1) | |
| for git_repo in *; do | |
| if ! [ -d "${git_repo}/.git" ]; then | |
| continue | |
| fi | |
| PREFIX="./${git_repo//-//}" | |
| pushd $git_repo > /dev/null | |
| echo $git_repo | |
| git checkout master > /dev/null 2>&1 | |
| rm -f "${DEST_DIR}/patch-${git_repo}" | |
| touch "${DEST_DIR}/patch-${git_repo}" | |
| echo "Summary:" >> "${DEST_DIR}/patch-${git_repo}" | |
| git diff --stat base..master >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "----" >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "" >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "" >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "Files modified:" >> "${DEST_DIR}/patch-${git_repo}" | |
| git log --stat base..master >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "----" >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "" >> "${DEST_DIR}/patch-${git_repo}" | |
| echo "" >> "${DEST_DIR}/patch-${git_repo}" | |
| git diff --src-prefix="${PREFIX}.orig/" --dst-prefix="${PREFIX}/" base..master >> "${DEST_DIR}/patch-${git_repo}" | |
| popd > /dev/null | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment