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 f7cff58

Browse filesBrowse files
dries007Byron
authored andcommitted
Added parsing for '@1400000000 +0000' date format as used by git commit hooks.
1 parent 313b3b4 commit f7cff58
Copy full SHA for f7cff58

3 files changed

+9Lines changed: 9 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎AUTHORS‎

Copy file name to clipboardExpand all lines: AUTHORS
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ Contributors are:
3737
-Anil Khatri <anil.soccer.khatri _at_ gmail.com>
3838
-JJ Graham <thetwoj _at_ gmail.com>
3939
-Ben Thayer <ben _at_ benthayer.com>
40+
-Dries Kennes <admin _at_ dries007.net>
4041

4142
Portions derived from other open source works and are clearly marked.
Collapse file

‎git/objects/util.py‎

Copy file name to clipboardExpand all lines: git/objects/util.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def parse_date(string_date):
148148
try:
149149
if string_date.count(' ') == 1 and string_date.rfind(':') == -1:
150150
timestamp, offset = string_date.split()
151+
if timestamp.startswith('@'):
152+
timestamp = timestamp[1:]
151153
timestamp = int(timestamp)
152154
return timestamp, utctz_to_altz(verify_utctz(offset))
153155
else:
Collapse file

‎git/test/test_repo.py‎

Copy file name to clipboardExpand all lines: git/test/test_repo.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ def test_clone_from_keeps_env(self, rw_dir):
220220

221221
assert_equal(environment, cloned.git.environment())
222222

223+
@with_rw_directory
224+
def test_date_format(self, rw_dir):
225+
repo = Repo.init(osp.join(rw_dir, "repo"))
226+
# @-timestamp is the format used by git commit hooks
227+
repo.index.commit("Commit messages", commit_date="@1400000000 +0000")
228+
223229
@with_rw_directory
224230
def test_clone_from_pathlib(self, rw_dir):
225231
if pathlib is None: # pythons bellow 3.4 don't have pathlib

0 commit comments

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