Subject: bug#51365: 29.0.50; org-mode: modification-time error with git controled file

From: Kyle Meyer <[email-masked]>
Date: Sat, 11 Dec 2021 11:20:58 -0500

close 51365 28.1
quit

TAKAHASHI Yoshio writes:

> Hi,
>
> With git controled file,
> {{{modification-time(%Y-%02m-%02dT%02H:%02M:%02S+09:00, 1)}}}
> causes "Wrong type argument: stringp, " error.
>
> `org-macro--vc-modified-time' in org-macro.el should pass list of FILE
> to `vc-call', because `vc-git-print-log' expects list of file as its 1st
> argument.

Thanks for the report and fix.  This failure is new with Emacs 28,
specifically 3572613550f (Fix vc-git-state for filenames with wildcards,
2021-08-15).  Before that, passing a string instead of a list worked
okay because vc-git-print-log just passed its FILES argument untouched
to vc-git-command's FILE-OR-LIST.

> diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
> index b8d3373418..9e70844963 100644
> --- a/lisp/org/org-macro.el
> +++ b/lisp/org/org-macro.el
> @@ -368,7 +368,7 @@ org-macro--vc-modified-time
>  	    date)
>  	(unwind-protect
>  	    (progn
> -	      (vc-call print-log file buf nil nil 1)
> +	      (vc-call print-log (list file) buf nil nil 1)
>  	      (with-current-buffer buf
>  		(vc-exec-after
>  		 (lambda ()

Looks good to me.  I confirmed the bug and fix only with vc-git,
although the change looks appropriate for the other backends too:

  $ git grep -E '\(defun vc-.+-print-log'
  lisp/vc/vc-bzr.el:(defun vc-bzr-print-log (files buffer &optional shortlog start-revision limit)
  lisp/vc/vc-cvs.el:(defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit)
  lisp/vc/vc-dav.el:(defun vc-dav-print-log (_url)
  lisp/vc/vc-git.el:(defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
  lisp/vc/vc-hg.el:(defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
  lisp/vc/vc-mtn.el:(defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit)
  lisp/vc/vc-rcs.el:(defun vc-rcs-print-log-cleanup ()
  lisp/vc/vc-rcs.el:(defun vc-rcs-print-log (files buffer &optional _shortlog
  lisp/vc/vc-sccs.el:(defun vc-sccs-print-log (files buffer &optional _shortlog _start-revision-ignored limit)
  lisp/vc/vc-src.el:(defun vc-src-print-log (files buffer &optional shortlog _start-revision limit)
  lisp/vc/vc-svn.el:(defun vc-svn-print-log (files buffer &optional _shortlog start-revision limit)

So, I've added a commit message to above patch and applied it in your
name on Org's bugfix branch (888689f2b).