Created
March 17, 2020 19:04
-
-
Save dbalatero/13272fe43297fb4dabd93c6f4efcf009 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Got these from the event that reads like: | |
# "dbalatero force-pushed the my-feature-branch branch from 7c66458 to c559af0" | |
old_head=7c66458 | |
new_head=c559af0 | |
echo "CASE 1: A force-pushed branch that has no branch changes, just the latest master" | |
echo " e.g. they just did git rebase master && git push --force-with-lease" | |
echo | |
echo "With PR: https://github.com/dbalatero/test-repo/pull/1" | |
echo "It had been force pushed from $old_head to $new_head, with no distinguishable changes." | |
echo | |
old_diff=$(curl --silent -H 'Accept: application/vnd.github.v3.diff' \ | |
https://github.com/dbalatero/test-repo/compare/master...$old_head.diff) | |
echo "Patch from $old_head:" | |
echo "====" | |
echo "$old_diff" | |
echo | |
echo "MD5 sum: $(echo "$old_diff" | md5sum)" | |
echo | |
new_diff=$(curl --silent -H 'Accept: application/vnd.github.v3.diff' \ | |
https://github.com/dbalatero/test-repo/compare/master...$new_head.diff) | |
echo "Patch from $new_head:" | |
echo "====" | |
echo "$new_diff" | |
echo | |
echo "MD5 sum: $(echo "$new_diff" | md5sum)" | |
echo | |
############################################# | |
old_head=eabdef5 | |
new_head=e20185f | |
echo "================================" | |
echo | |
echo "CASE 2: A branch that pushed changes, then did more work and rebased master, then force pushed" | |
echo | |
echo "With PR: https://github.com/dbalatero/test-repo/pull/3" | |
echo | |
old_diff=$(curl --silent -H 'Accept: application/vnd.github.v3.diff' \ | |
https://github.com/dbalatero/test-repo/compare/master...$old_head.diff) | |
echo "Patch from $old_head:" | |
echo "====" | |
echo "$old_diff" | |
echo | |
echo "MD5 sum: $(echo "$old_diff" | md5sum)" | |
echo | |
new_diff=$(curl --silent -H 'Accept: application/vnd.github.v3.diff' \ | |
https://github.com/dbalatero/test-repo/compare/master...$new_head.diff) | |
echo "Patch from $new_head:" | |
echo "====" | |
echo "$new_diff" | |
echo | |
echo "MD5 sum: $(echo "$new_diff" | md5sum)" | |
echo |
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
CASE 1: A force-pushed branch that has no branch changes, just the latest master | |
e.g. they just did git rebase master && git push --force-with-lease | |
With PR: https://github.com/dbalatero/test-repo/pull/1 | |
It had been force pushed from 7c66458 to c559af0, with no distinguishable changes. | |
Patch from 7c66458: | |
==== | |
diff --git a/new-file b/new-file | |
new file mode 100644 | |
index 0000000..e69de29 | |
MD5 sum: 5dd247d9772a9986e1aaa72f864827b0 - | |
Patch from c559af0: | |
==== | |
diff --git a/new-file b/new-file | |
new file mode 100644 | |
index 0000000..e69de29 | |
MD5 sum: 5dd247d9772a9986e1aaa72f864827b0 - | |
================================ | |
CASE 2: A branch that pushed changes, then did more work and rebased master, then force pushed | |
With PR: https://github.com/dbalatero/test-repo/pull/3 | |
Patch from eabdef5: | |
==== | |
diff --git a/file1 b/file1 | |
new file mode 100644 | |
index 0000000..e69de29 | |
MD5 sum: 46040c4064f8683521177d7aee92aebc - | |
Patch from e20185f: | |
==== | |
diff --git a/file1 b/file1 | |
new file mode 100644 | |
index 0000000..e69de29 | |
diff --git a/file2 b/file2 | |
new file mode 100644 | |
index 0000000..e69de29 | |
MD5 sum: afba85eabc2d5d5d50b3b64da6151b48 - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment