zivyangll/git-blame.vim

date time is not parsed correctly

Closed this issue · 6 comments

The status line show something like following:
[07bf89423] doc: add documentations <jim@mailbox.com> Jim (/bin/date: 1546604367 : No such file or directory)

I guess this line should make some changes by replacing 'date -r', which caused the unsuccessful date parsing, with 'date -d @ '.

@jimhuaang Thanks for your providing bugs. It's ok now.

just reinstall git-blame.vim.

@zivyangll But it always show current time now.

@jimhuaang I fixed it with #9 . If you use Windows, you can try it on "Linux Shell", eg. Cygwin.

Thanks @zivyangll. My OS is Ubuntu.
#9 this commit just turn this issue back to the original.
As i mentioned at the first point, change 'date -r' to 'date -d @' works very well on Linux.

'date -r' will display the mtime of given FILE, but in the code the author-time (since epoch) is passed, so 'date -d @' just fix it.

@jimhuaang there are some different with Mac OS and Ubuntu.

In Mac OS:

➜ date -r 1539561600
Mon Oct 15 08:00:00 CST 2018
➜ date -d @1539561600
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

Mac OS hasn't the usage with 'data -d @'.

@zivyangll
I have create a pull request for this. strftime() in Vim has been used to parse the time. It works well on both MacOS and Linux