Permalink
Browse files

Better Jira formatted commit-notes

  • Loading branch information...
1 parent 4b1e59b commit 1396b8175e69fc0f75f0e4ec9c48752dd57ffb28 @craveytrain committed Dec 6, 2013
Showing with 8 additions and 3 deletions.
  1. +8 −3 bin/git-commit-notes
View
@@ -1,17 +1,22 @@
#!/bin/bash
COMMIT_ID=$(git rev-parse --short ${1:-"HEAD"})
+COMMIT_ID_LONG=$(git rev-parse ${1:-"HEAD"})
COMMIT_MSG="$(git log $COMMIT_ID~1..$COMMIT_ID --pretty=%B)"
ORIGIN="$(git config --get remote.origin.url)"
ORIGIN_PATH="${ORIGIN#*github.com\:}"
ORIGIN_PATH_SANS_EXT="${ORIGIN_PATH%.git}"
COMMIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
COMMIT_URL="https://github.com/$ORIGIN_PATH_SANS_EXT/commit/$COMMIT_ID"
-COMMIT_NOTES="$COMMIT_ID $COMMIT_URL\n\n$COMMIT_MSG\n\nBranch: $COMMIT_BRANCH"
+COMMIT_NOTES="{panel:title=Commit: $COMMIT_ID}\n"
+COMMIT_NOTES+="\tBranch: [$COMMIT_BRANCH|https://github.com/$ORIGIN_PATH_SANS_EXT/tree/$COMMIT_BRANCH]\n"
+COMMIT_NOTES+="\tGithub: [$COMMIT_ID|https://github.com/$ORIGIN_PATH_SANS_EXT/commit/$COMMIT_ID]\n\n"
+COMMIT_NOTES+="\t$COMMIT_MSG\n"
+COMMIT_NOTES+="{panel}"
-echo -e "$COMMIT_NOTES"
+echo -e "$(git log $COMMIT_ID~1..$COMMIT_ID)"
if [ -x "$(which pbcopy)" ]; then
echo -e "$COMMIT_NOTES" | pbcopy
-fi
+fi

0 comments on commit 1396b81

Please sign in to comment.