Allow git-blob-include-processor to discover other repos

Massive oversight over here which I forgot to update when moving it in
its own repo. Whoops.
This commit is contained in:
Gabriel Arazas 2023-10-28 18:11:28 +08:00
parent 5ec7195fc8
commit 5ebea76900
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,9 @@ If the resulting operation ends in an error (i.e., non-existing revision, file,
== Attributes
- `gitrepo` is the path to the Git repo.
By default, it is the base directory of the document.
- `path` is the filepath to be retrieved from the revision.
When used with `diff`, it changes into a semicolon-delimited (`;`) list of files to make diffs with multiple files.

View File

@ -8,7 +8,8 @@ class GitBlobIncludeProcessor < Asciidoctor::Extensions::IncludeProcessor
end
def process(doc, reader, target, attrs)
repo = Rugged::Repository.discover(__dir__)
attrs['gitrepo'] ||= doc.base_dir
repo = Rugged::Repository.discover(attrs['gitrepo'])
git_object_ref = target.delete_prefix 'git:'
git_object_ref = doc.attributes['doccontentref'] if git_object_ref.empty?