summaryrefslogtreecommitdiff
path: root/support/git-set-file-times
diff options
context:
space:
mode:
authorYoichi NAKAYAMA <yoichi.nakayama@gmail.com>2022-04-12 00:57:19 +0900
committerGitHub <noreply@github.com>2022-04-11 08:57:19 -0700
commit2fda51692be7a6268e97237f7cf43f7ac16023f7 (patch)
treecaf5e50f0d4cfc1bca387daa7cb4500f2f6af94c /support/git-set-file-times
parent1de71e8a7870fa1be29f562df61f4c5c4685818f (diff)
downloadrsync-2fda51692be7a6268e97237f7cf43f7ac16023f7.tar.gz
Specify log format to avoid malfunctions and unexpected errors. (#305)
Solve the following problems: * mishandling of commit message lines similar to committer lines * UnicodeDecodeError with commit messages that cannot be interpreted as utf-8
Diffstat (limited to 'support/git-set-file-times')
-rwxr-xr-xsupport/git-set-file-times4
1 files changed, 2 insertions, 2 deletions
diff --git a/support/git-set-file-times b/support/git-set-file-times
index 24b3fde5..e06f0737 100755
--- a/support/git-set-file-times
+++ b/support/git-set-file-times
@@ -38,7 +38,7 @@ def main():
print_line(fn, mtime, mtime)
ls.discard(fn)
- cmd = git + 'log -r --name-only --no-color --pretty=raw --no-renames -z'.split()
+ cmd = git + 'log -r --name-only --format=%x00commit%x20%H%n%x00commit_time%x20%ct%n --no-renames -z'.split()
if args.tree:
cmd.append(args.tree)
cmd += ['--'] + args.files
@@ -46,7 +46,7 @@ def main():
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
for line in proc.stdout:
line = line.strip()
- m = re.match(r'^committer .*? (\d+) [-+]\d+$', line)
+ m = re.match(r'^\0commit_time (\d+)$', line)
if m:
commit_time = int(m[1])
elif NULL_COMMIT_RE.search(line):