Created
June 24, 2016 15:47
-
-
Save frontrangerider2004/b29c78ccf2e0104722444e7a3875415f to your computer and use it in GitHub Desktop.
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
| ############################################################################### | |
| # generateOutputFilename | |
| # | |
| # Get a unique timestamped filename with the date, git hash, and branch to | |
| # patch. The stanza is <userPrefix>-date-hash-for-<branch>.patch | |
| # | |
| # NOTE: Date formate is ddmmyy_hhmmss in 24hr format | |
| # NOTE: Git hash is the last 7 chars | |
| ############################################################################### | |
| function generateOutputFilename { | |
| logD "[generateOutputFilename]" | |
| cd "$REPO_DIR" | |
| # Get the date formatted in daymonthyear_hhmmss | |
| local date="$(date +%d%m%y_%H%M%S)" | |
| local gitHash="$(git rev-parse --short HEAD)" | |
| logD "[generateOutputFilename] Date, %d%m%y_%H%M%S: $date" | |
| logD "[generateOutputFilename] Git Hash, git rev-parse --short HEAD: $gitHash" | |
| if [ -n "$PATCH_FILE" ]; then | |
| OUT_FILE="$PATCH_FILE-$date-$gitHash-for-$BRANCH_TO_PATCH.patch" | |
| else | |
| OUT_FILE="$date-$gitHash-for-$BRANCH_TO_PATCH.patch" | |
| fi | |
| } | |
| ############################################################################### | |
| # createGitPatch | |
| # | |
| # Generates a git patch where all the commits are in one file rather | |
| # than individual files for each commit. | |
| ############################################################################### | |
| function createGitPatch { | |
| logD "[createGitPatch]" | |
| cd "$REPO_DIR" | |
| git format-patch $BRANCH_TO_PATCH --stdout > "$OUT_DIR/$OUT_FILE" | |
| cd "$ABS_SCRIPT_PATH" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment