Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve the way we retrieve the full commit hash from shorthash #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 cherry_picker/cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ def get_current_branch():


def get_full_sha_from_short(short_sha):
cmd = f"git show --format=raw {short_sha}"
cmd = f"git log -1 --format='%H' {short_sha}"
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
full_sha = output.strip().decode('utf-8').split('\n')[0].split()[1]
full_sha = output.strip().decode('utf-8')
return full_sha


Expand Down
14 changes: 1 addition & 13 deletions 14 cherry_picker/cherry_picker/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,7 @@ def test_get_current_branch(subprocess_check_output):

@mock.patch('subprocess.check_output')
def test_get_full_sha_from_short(subprocess_check_output):
mock_output = b"""commit 22a594a0047d7706537ff2ac676cdc0f1dcb329c
tree 14ab2ea85e7a28adb9d40f185006308d87a67f47
parent 5908300e4b0891fc5ab8bd24fba8fac72012eaa7
author Armin Rigo <armin.rigo@gmail.com> 1492106895 +0200
committer Mariatta <Mariatta@users.noreply.github.com> 1492106895 -0700

bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089)

diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index fc7ce5e..1914229 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
"""
mock_output = b"""22a594a0047d7706537ff2ac676cdc0f1dcb329c"""
subprocess_check_output.return_value = mock_output
assert get_full_sha_from_short('22a594a') == '22a594a0047d7706537ff2ac676cdc0f1dcb329c'

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.