Skip to content

Commit 7dd32a2

Browse files
committed
Change date=unix to date=raw for compatibility with old gits
1 parent 36298e4 commit 7dd32a2

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,9 @@ jobs:
103103
provider: script
104104
script: bash ci/deb-ppa-upload/travis-deploy.sh
105105
on: { branch: master }
106+
107+
108+
notifications:
109+
email:
110+
on_success: change
111+
on_failure: always

git_machete/cmd.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,24 +1026,24 @@ def load_branches():
10261026
values = line.split("\t")
10271027
if len(values) != 3: # invalid, shouldn't happen
10281028
continue
1029-
b, sha, committer_unix_timestamp = values
1029+
b, sha, committer_unix_timestamp_and_time_zone = values
10301030
b_stripped = re.sub("^refs/remotes/", "", b)
10311031
remote_branches_cached += [b_stripped]
10321032
commit_sha_by_revision_cached[b] = sha
1033-
committer_unix_timestamp_by_revision_cached[b] = int(committer_unix_timestamp.split(' ')[0])
1033+
committer_unix_timestamp_by_revision_cached[b] = int(committer_unix_timestamp_and_time_zone.split(' ')[0])
10341034

10351035
raw_local = non_empty_lines(popen_git("for-each-ref", "--format=%(refname)\t%(objectname)\t%(committerdate:raw)\t%(upstream)", "refs/heads"))
10361036

10371037
for line in raw_local:
10381038
values = line.split("\t")
10391039
if len(values) != 4: # invalid, shouldn't happen
10401040
continue
1041-
b, sha, committer_unix_timestamp, fetch_counterpart = values
1041+
b, sha, committer_unix_timestamp_and_time_zone, fetch_counterpart = values
10421042
b_stripped = re.sub("^refs/heads/", "", b)
10431043
fetch_counterpart_stripped = re.sub("^refs/remotes/", "", fetch_counterpart)
10441044
local_branches_cached += [b_stripped]
10451045
commit_sha_by_revision_cached[b] = sha
1046-
committer_unix_timestamp_by_revision_cached[b] = int(committer_unix_timestamp.split(' ')[0])
1046+
committer_unix_timestamp_by_revision_cached[b] = int(committer_unix_timestamp_and_time_zone.split(' ')[0])
10471047
if fetch_counterpart_stripped in remote_branches_cached:
10481048
counterparts_for_fetching_cached[b_stripped] = fetch_counterpart_stripped
10491049

@@ -1308,13 +1308,14 @@ def is_excluded_reflog_subject(sha_, gs_):
13081308

13091309

13101310
def get_latest_checkout_timestamps():
1311-
# Entries are in the format '<branch_name>@{unix_timestamp}'
1311+
# Entries are in the format '<branch_name>@{<unix_timestamp> <time-zone>}'
13121312
result = {}
1313-
# %gd - reflog selector (HEAD@{unix timestamp})
1313+
# %gd - reflog selector (HEAD@{<unix-timestamp> <time-zone>} for `--date=raw`;
1314+
# `--date=unix` is not available on some older versions of git)
13141315
# %gs - reflog subject
1315-
output = popen_git("reflog", "show", "--format=%gd:%gs", "--date=unix")
1316+
output = popen_git("reflog", "show", "--format=%gd:%gs", "--date=raw")
13161317
for entry in non_empty_lines(output):
1317-
pattern = "^HEAD@\\{([0-9]+)\\}:checkout: moving from (.+) to (.+)$"
1318+
pattern = "^HEAD@\\{([0-9]+) .+\\}:checkout: moving from (.+) to (.+)$"
13181319
match = re.search(pattern, entry)
13191320
if match:
13201321
from_branch = match.group(2)

0 commit comments

Comments
 (0)