Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit96c7ac2

Browse files
committed
Fixed incorrect handling of rev_parse if it was fed with branches that looked like hexshas. Thanks to Ning (frostyplanet) who pointed this issue out
1 parent5eb7fd3 commit96c7ac2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎git/repo/fun.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ def name_to_object(repo, name, return_ref=False):
5959
else:
6060
hexsha=name
6161
# END handle short shas
62-
else:
62+
#END find sha if it matches
63+
64+
# if we couldn't find an object for what seemed to be a short hexsha
65+
# try to find it as reference anyway, it could be named 'aaa' for instance
66+
ifhexshaisNone:
6367
forbasein ('%s','refs/%s','refs/tags/%s','refs/heads/%s','refs/remotes/%s','refs/remotes/%s/HEAD'):
6468
try:
6569
hexsha=SymbolicReference.dereference_recursive(repo,base%name)

‎git/test/test_repo.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ def _assert_rev_parse(self, name):
464464

465465
returnorig_obj
466466

467+
@with_rw_repo('HEAD',bare=False)
468+
deftest_rw_rev_parse(self,rwrepo):
469+
# verify it does not confuse branches with hexsha ids
470+
ahead=rwrepo.create_head('aaaaaaaa')
471+
assert(rwrepo.rev_parse(str(ahead))==ahead.commit)
472+
467473
deftest_rev_parse(self):
468474
rev_parse=self.rorepo.rev_parse
469475

@@ -573,7 +579,6 @@ def test_rev_parse(self):
573579
# currently, nothing more is supported
574580
self.failUnlessRaises(NotImplementedError,rev_parse,"@{1 week ago}")
575581

576-
577582
deftest_repo_odbtype(self):
578583
target_type=GitDB
579584
ifsys.version_info[1]<5:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp