diff options
| -rw-r--r-- | lisp/magit-git.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/magit-git.el b/lisp/magit-git.el index dd900f2..2026d2f 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1337,10 +1337,13 @@ Sorted from longest to shortest CYGWIN name." (equal (magit-object-type obj) "blob")) (defun magit-blob-oid (rev file) - (if (equal rev "{index}") - (cadr (car (magit--file-index-stages file))) - (magit-git-string "ls-tree" "--full-tree" "--object-only" rev "--" - (magit-convert-filename-for-git file)))) + (cond-let + ((equal rev "{index}") + (cadr (car (magit--file-index-stages file)))) + ;; --object-only and --format were only added in Git v2.36.0. + ([out (magit-git-string "ls-tree" "--full-tree" rev "--" + (magit-convert-filename-for-git file))] + (nth 2 (split-string out "[\s\t]"))))) (defun magit--file-index-stages (file) (mapcar (##split-string % " ") |
