Merge lp:~jelmer/brz/git-short into lp:brz

Proposed by Jelmer Vernooij on 2019-02-03
Status: Merged
Approved by: Jelmer Vernooij on 2019-02-03
Approved revision: 7266
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/git-short
Merge into: lp:brz
Diff against target: 27 lines (+3/-5)
2 files modified
breezy/git/revspec.py (+2/-5)
breezy/git/tests/test_revspec.py (+1/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-short
Reviewer Review Type Date Requested Status
Martin Packman 2019-02-03 Approve on 2019-02-03
Review via email: mp+362643@code.launchpad.net

Commit message

Don't require that short git shas have an even number of characters.

Description of the change

Don't require that short git shas have an even number of characters.

To post a comment you must log in.
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/revspec.py'
2--- breezy/git/revspec.py 2018-11-11 04:08:32 +0000
3+++ breezy/git/revspec.py 2019-02-03 01:52:42 +0000
4@@ -40,12 +40,9 @@
5 :param hex: Hex string to validate
6 :return: Boolean
7 """
8- import binascii
9 try:
10- binascii.unhexlify(hex)
11- except TypeError:
12- return False
13- except binascii.Error:
14+ int(hex, 16)
15+ except ValueError:
16 return False
17 else:
18 return True
19
20=== modified file 'breezy/git/tests/test_revspec.py'
21--- breezy/git/tests/test_revspec.py 2018-11-11 04:08:32 +0000
22+++ breezy/git/tests/test_revspec.py 2019-02-03 01:52:42 +0000
23@@ -32,3 +32,4 @@
24
25 def test_valid(self):
26 self.assertTrue(valid_git_sha1(b"aabbccddee"))
27+ self.assertTrue(valid_git_sha1(b"aabbccd"))

Subscribers

People subscribed via source and target branches