Created
April 29, 2014 03:43
-
-
Save wenjianhn/11390206 to your computer and use it in GitHub Desktop.
Check if a patch has already been merged as a specified commit.
This file contains 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/bash | |
if [[ -z $2 ]]; then | |
echo -e "Usage:\n $0 <patch> <commit>" | |
exit 1 | |
fi | |
PATCH=$1 | |
COMMIT=$2 | |
merged='not' | |
if [[ $(sed -n -e '/diff --git/,$p' ${PATCH} | sha1sum) = \ | |
$(git show ${COMMIT} | sed -n -e '/diff --git/,$p' | sha1sum) ]]; then | |
merged= | |
fi | |
echo ${PATCH} has ${merged} been merged as commit ${COMMIT}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment