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

Commit 02d294e

Browse filesBrowse files
authored
Improve the way we retrieve the full commit hash from the shorthash (GH-213)
1 parent 87f6557 commit 02d294e
Copy full SHA for 02d294e

File tree

Expand file treeCollapse file tree

2 files changed

+3
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-15
lines changed

‎cherry_picker/cherry_picker/cherry_picker.py

Copy file name to clipboardExpand all lines: cherry_picker/cherry_picker/cherry_picker.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ def get_current_branch():
390390

391391

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

398398

‎cherry_picker/cherry_picker/test.py

Copy file name to clipboardExpand all lines: cherry_picker/cherry_picker/test.py
+1-13Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,7 @@ def test_get_current_branch(subprocess_check_output):
2828

2929
@mock.patch('subprocess.check_output')
3030
def test_get_full_sha_from_short(subprocess_check_output):
31-
mock_output = b"""commit 22a594a0047d7706537ff2ac676cdc0f1dcb329c
32-
tree 14ab2ea85e7a28adb9d40f185006308d87a67f47
33-
parent 5908300e4b0891fc5ab8bd24fba8fac72012eaa7
34-
author Armin Rigo <armin.rigo@gmail.com> 1492106895 +0200
35-
committer Mariatta <Mariatta@users.noreply.github.com> 1492106895 -0700
36-
37-
bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089)
38-
39-
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
40-
index fc7ce5e..1914229 100644
41-
--- a/Lib/pathlib.py
42-
+++ b/Lib/pathlib.py
43-
"""
31+
mock_output = b"""22a594a0047d7706537ff2ac676cdc0f1dcb329c"""
4432
subprocess_check_output.return_value = mock_output
4533
assert get_full_sha_from_short('22a594a') == '22a594a0047d7706537ff2ac676cdc0f1dcb329c'
4634

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.