]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Fix git-set-file-times's handling of staged changed files.
authorWayne Davison <wayne@opencoder.net>
Mon, 15 Mar 2021 16:02:00 +0000 (09:02 -0700)
committerWayne Davison <wayne@opencoder.net>
Mon, 15 Mar 2021 16:35:39 +0000 (09:35 -0700)
support/git-set-file-times

index 51962d37b5e1e8e4aed0d85436ccc1ad17385ec7..24b3fde54875af66b4db23b331037826559ae01d 100755 (executable)
@@ -27,11 +27,12 @@ def main():
 
     if not args.tree:
         # All modified files keep their current mtime.
-        proc = subprocess.Popen(git + 'ls-files -m -z'.split(), stdout=subprocess.PIPE, encoding='utf-8')
+        proc = subprocess.Popen(git + 'status -z --no-renames'.split(), stdout=subprocess.PIPE, encoding='utf-8')
         out = proc.communicate()[0]
         for fn in out.split('\0'):
-            if fn == '':
+            if fn == '' or (fn[0] != 'M' and fn[1] != 'M'):
                 continue
+            fn = fn[3:]
             if args.list:
                 mtime = os.lstat(fn).st_mtime
                 print_line(fn, mtime, mtime)