diff --git a/build_docs b/build_docs index 05b2f28d15ce5..b68440fe213b6 100755 --- a/build_docs +++ b/build_docs @@ -29,7 +29,8 @@ from __future__ import print_function import logging from os import environ, getgid, getuid -from os.path import basename, dirname, exists, isdir, join, realpath +from os.path import basename, dirname, exists, expanduser, isdir +from os.path import join, realpath import re import subprocess from sys import platform, version_info @@ -117,8 +118,7 @@ def run_build_docs(args): '-v', '%s:%s:ro,cached' % (repo_root, repo_mount) ]) - build_docs_args.append( - repo_mount + path.replace(repo_root, '')) + return repo_mount + path.replace(repo_root, '') open_browser = False args = Args(args) @@ -164,7 +164,8 @@ def run_build_docs(args): doc_file = realpath(args.next_arg_or_err()) if not exists(doc_file): raise ArgError("Can't find --doc %s" % doc_file) - mount_docs_repo_and_dockerify_path(dirname(doc_file), doc_file) + build_docs_args.append(mount_docs_repo_and_dockerify_path( + dirname(doc_file), doc_file)) saw_doc = True elif arg == '--open': docker_args.extend(['--publish', '8000:8000/tcp']) @@ -200,7 +201,19 @@ def run_build_docs(args): resource_dir = realpath(args.next_arg_or_err()) if not isdir(resource_dir): raise ArgError("Can't find --resource %s" % resource_dir) - mount_docs_repo_and_dockerify_path(resource_dir, resource_dir) + build_docs_args.append(mount_docs_repo_and_dockerify_path( + resource_dir, resource_dir)) + elif arg == '--sub_dir': + sub = args.next_arg_or_err() + m = re.match('(?P[^:]+):(?P[^:]+):(?P.+)', sub) + if not m: + raise ArgError("Invalid --sub_dir %s" % sub) + sub_dir = realpath(expanduser(m.group('dir'))) + if not exists(sub_dir): + raise ArgError("Can't find --sub_dir %s" % sub_dir) + mounted_path = mount_docs_repo_and_dockerify_path(sub_dir, sub_dir) + build_docs_args.append("%s:%s:%s" % ( + m.group('repo'), m.group('branch'), mounted_path)) arg = args.next_arg() if saw_doc and not saw_out: diff --git a/build_docs.pl b/build_docs.pl index 96f533b9dcbf9..cf16f530f25be 100755 --- a/build_docs.pl +++ b/build_docs.pl @@ -55,7 +55,7 @@ BEGIN GetOptions( $Opts, # - 'all', 'push', 'target_repo=s', 'reference=s', 'rebuild', 'no_fetch', # + 'all', 'push', 'target_repo=s', 'reference=s', 'rebuild', 'keep_hash', 'sub_dir=s@', 'single', 'pdf', 'doc=s', 'out=s', 'toc', 'chunk=i', 'suppress_migration_warnings', 'open', 'skiplinkcheck', 'linkcheckonly', 'staging', 'procs=i', 'user=s', 'lang=s', 'lenient', 'verbose', 'reload_template', 'resource=s@', 'asciidoctor', 'in_standard_docker', @@ -464,7 +464,11 @@ sub init_repos { user => $Opts->{user}, url => $Opts->{target_repo}, reference => $reference_dir, - # intentionally not passing the tracker because we don't want to use it + # We can't keep the hash of the target repo because it is what stores + # the hashes in the first place! + keep_hash => 0, + # Intentionally not passing the tracker because we need to build the + # tracker from information in this repo. ); delete $child_dirs{ $target_repo->git_dir->absolute }; my $target_repo_checkout = "$temp_dir/target_repo"; @@ -498,6 +502,7 @@ sub init_repos { user => $Opts->{user}, url => $url, reference => $reference_dir, + keep_hash => $Opts->{keep_hash}, ); delete $child_dirs{ $repo->git_dir->absolute }; @@ -507,7 +512,7 @@ sub init_repos { else { $pm->start($name) and next; eval { - $repo->update_from_remote() unless $Opts->{no_fetch}; + $repo->update_from_remote(); 1; } or do { # If creds are invalid, explicitly reject them to try to clear the cache @@ -522,6 +527,16 @@ sub init_repos { } $pm->wait_all_children; + # Parse the --sub_dir options and attach the to the repo + my %sub_dirs = (); + foreach (@{ $Opts->{sub_dir} }) { + die "invalid --sub_dir $_" + unless /(?[^:]+):(?[^:]+):(?.+)/; + my $dir = dir($+{dir})->absolute; + die "--sub_dir $dir doesn't exist" unless -e $dir; + ES::Repo->get_repo($+{repo})->add_sub_dir($+{branch}, $dir); + } + for ( keys %child_dirs ) { my $dir = dir($_); next unless -d $dir; @@ -682,7 +697,8 @@ sub check_args { die('--user not compatible with --doc') if $Opts->{user}; die('--reference not compatible with --doc') if $Opts->{reference}; die('--rebuild not compatible with --doc') if $Opts->{rebuild}; - die('--no_fetch not compatible with --doc') if $Opts->{no_fetch}; + die('--keep_hash not compatible with --doc') if $Opts->{keep_hash}; + die('--sub_dir not compatible with --doc') if $Opts->{sub_dir}; die('--skiplinkcheck not compatible with --doc') if $Opts->{skiplinkcheck}; die('--linkcheckonly not compatible with --doc') if $Opts->{linkcheckonly}; } else { @@ -703,9 +719,10 @@ sub pick_conf { #=================================== return 'conf.yaml' unless $Opts->{conf}; - my $conf = dir($Old_Pwd)->file($Opts->{conf}); + my $conf = file($Opts->{conf}); + $conf = dir($Old_Pwd)->file($Opts->{conf}) if $conf->is_relative; return $conf if -e $conf; - die $Opts->{conf} . " doesn't exist"; + die "$conf doesn't exist"; } #=================================== @@ -793,7 +810,9 @@ sub usage { --skiplinkcheck Omit the step that checks for broken links --linkcheckonly Skips the documentation builds. Checks links only. --rebuild Rebuild all branches of every book regardless of what has changed - --no_fetch Skip fetching updates from source repos + --keep_hash Build docs from the same commit hash as last time + --sub_dir Use a directory as a branch of some repo + (eg --sub_dir elasticsearch:master:~/Code/elasticsearch) General Opts: --staging Use the template from the staging website diff --git a/integtest/Makefile b/integtest/Makefile index 746bfc7cbeee1..1b9ac59e747e6 100644 --- a/integtest/Makefile +++ b/integtest/Makefile @@ -1,5 +1,6 @@ SHELL = /bin/bash -eux -o pipefail MAKEFLAGS += --silent +TMP = /tmp/docs_integtest/$@ # Used by the test for --all export GIT_AUTHOR_NAME=Test @@ -18,7 +19,11 @@ check: \ missing_include_fails_asciidoc missing_include_fails_asciidoctor \ migration_warnings \ readme_expected_files readme_same_files \ - small_all_expected_files + simple_all \ + relative_conf_file \ + keep_hash \ + sub_dir \ + keep_hash_and_sub_dir .PHONY: style style: html_diff @@ -122,38 +127,170 @@ migration_warnings: migration_warnings.asciidoc /tmp/%_asciidoctor: $(BD) --asciidoctor --doc $*.asciidoc -.PHONY: small_all_expected_files -small_all_expected_files: /tmp/small_all - [ -s $^/redirects.conf ] - [ -s $^/html/branches.yaml ] - grep 'Test book' $^/html/index.html > /dev/null - grep '' $^/html/test/index.html > /dev/null - [ -s $^/html/test/current/index.html ] +.PHONY: simple_all +simple_all: + # Test the simplest possible `--all` invocation + rm -rf $(TMP) + $(BUILD_MINIMAL_ALL) + $(MINIMAL_ALL_EXPECTED_FILES) -.PRECIOUS: /tmp/small_all -/tmp/small_all: - # Builds "--all" documentation specified by by the "small_conf.yaml" file. +.PHONY: relative_conf_file +relative_conf_file: + # Make sure that using a relative referece to the --conf file works. + rm -rf $(TMP) + $(SETUP_MINIMAL_ALL) + cd $(TMP) && \ + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf conf.yaml + $(MINIMAL_ALL_EXPECTED_FILES) - # First build a repository to use as the source. - rm -rf /tmp/source - git init /tmp/source - cp minimal.asciidoc /tmp/source/ - cd /tmp/source && \ +.PHONY: keep_hash +keep_hash: + # Test that `--all --keep_hash` doesn't pull new updates + rm -rf $(TMP) + $(BUILD_MINIMAL_ALL) + + # REPLACE the minimal documentation in the source repo + cp ../README.asciidoc $(TMP)/source/index.asciidoc + cd $(TMP)/source && \ + git add . && \ + git commit -m 'README' + + # Rebuild the docs with --keep_hash which should ignore the replacement + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml \ + --keep_hash | tee $(TMP)/out + $(call GREP,'No changes to push',$(TMP)/out) + + # We expact the same files as the minimal because we the changes that we + # make shouldn't be included + $(MINIMAL_ALL_EXPECTED_FILES) + +.PHONY: sub_dir +sub_dir: + # Test that `--all --sub_dir` substitutes a directory for a branch of + # a repo. + rm -rf $(TMP) + + # We still need to build the source repo because the script wants to fetch + # it just in case we need another branch. + git init $(TMP)/source + cd $(TMP)/source && git commit --allow-empty -m "empty" + + # Setup the directory we'd like to substitute + mkdir $(TMP)/to_sub + cp minimal.asciidoc $(TMP)/to_sub/index.asciidoc + + git init --bare $(TMP)/dest.git + sed -e 's|--tmp--|$(TMP)|' small_conf.yaml > $(TMP)/conf.yaml + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml \ + --sub_dir source:master:$(TMP)/to_sub + + $(MINIMAL_ALL_EXPECTED_FILES) + +.PHONY: keep_hash_and_sub_dir +keep_hash_and_sub_dir: + # Test that `--all --keep_hash --sub_dir` keeps hashes the same for repos + # not specified by --sub_dir but forces rebuilding all books that include + # --sub_dir. + + rm -rf $(TMP) + $(call INIT_REPO_WITH_FILE,$(TMP)/source1,includes_source2.asciidoc,docs/index.asciidoc) + $(call INIT_REPO_WITH_FILE,$(TMP)/source2,included.asciidoc,index.asciidoc) + git init --bare $(TMP)/dest.git + + sed 's|--tmp--|$(TMP)|' two_repos_conf.yaml > $(TMP)/conf.yaml + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml + + # Move a "bad" file into source2 so we can be sure we're not picking it up + cp ../README.asciidoc $(TMP)/source2/index.asciidoc + cd $(TMP)/source2 && \ git add . && \ - git commit -m 'minimal' + git commit -m 'README' + + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml \ + --keep_hash | tee /tmp/out + $(call GREP,'No changes to push',/tmp/out) + + # Setup the directory we'd like to substitute + mkdir -p $(TMP)/to_sub/docs + cp includes_source2.asciidoc $(TMP)/to_sub/docs/index.asciidoc + echo "extra extra extra" >> $(TMP)/to_sub/docs/index.asciidoc + + /docs_build/build_docs.pl --in_standard_docker --all --push \ + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml \ + --keep_hash --sub_dir source1:master:$(TMP)/to_sub | tee $(TMP)/out + $(call GREP,'Pushing changes',$(TMP)/out) + + git clone $(TMP)/dest.git $(TMP)/dest + $(call GREP,'extra extra extra',$(TMP)/dest/html/test/current/_chapter.html) + +define GREP= + # grep for a string in a file, outputting the whole file if there isn't + # a match. + [ -e $(2) ] || { \ + echo "can't find $(2)"; \ + ls $$(dirname $(2)); \ + false; \ + } + grep $(1) $(2) > /dev/null || { \ + echo "Couldn't find $(1) in $(2):"; \ + cat $(2); \ + false; \ + } +endef + +define SETUP_MINIMAL_ALL= + # First build a repository to use as the source. + $(call INIT_REPO_WITH_FILE,$(TMP)/source,minimal.asciidoc,index.asciidoc) # Initialize a bare repository that the docs build process can use as a # remote. It is used to pushing to github but it can push to a remote on # the filesystem just fine. - git init --bare /tmp/small_all.git + git init --bare $(TMP)/dest.git # Actually build the docs + sed 's|--tmp--|$(TMP)|' small_conf.yaml > $(TMP)/conf.yaml +endef + +define BUILD_MINIMAL_ALL= + # Builds `--all` docs using a "minimal" source file + $(SETUP_MINIMAL_ALL) /docs_build/build_docs.pl --in_standard_docker --all --push \ - --target_repo /tmp/small_all.git \ - --conf small_conf.yaml + --target_repo $(TMP)/dest.git \ + --conf $(TMP)/conf.yaml +endef - # Check out the files we just built - git clone /tmp/small_all.git /tmp/small_all +define MINIMAL_ALL_EXPECTED_FILES= + # Checks that $(1).git contains the expected result of building the + # "minimal" source file + git clone $(TMP)/dest.git $(TMP)/dest + [ -s $(TMP)/dest/redirects.conf ] + [ -s $(TMP)/dest/html/branches.yaml ] + $(call GREP,'Test book',$(TMP)/dest/html/index.html) + $(call GREP,'',$(TMP)/dest/html/test/index.html) + [ -s $(TMP)/dest/html/test/current/index.html ] +endef + +define INIT_REPO_WITH_FILE= + # Initializes the repo at $(1) and commits the file in $(2) with the + # name $(3) + git init $(1) + mkdir -p $$(dirname $(1)/$(3)) + cp $(2) $(1)/$(3) + cd $(1) && \ + git add . && \ + git commit -m 'init' +endef define GREP= # grep for a string in a file, outputting the whole file if there isn't @@ -168,4 +305,4 @@ define GREP= cat $(2); \ false; \ } -endef \ No newline at end of file +endef diff --git a/integtest/includes_source2.asciidoc b/integtest/includes_source2.asciidoc new file mode 100644 index 0000000000000..9f7b8e73e913b --- /dev/null +++ b/integtest/includes_source2.asciidoc @@ -0,0 +1,9 @@ += Title + +== Chapter + +I include simple between here + +include::../../source2/index.asciidoc[] + +and here. diff --git a/integtest/small_conf.yaml b/integtest/small_conf.yaml index 10c1e155dd8f2..9064474b4d751 100644 --- a/integtest/small_conf.yaml +++ b/integtest/small_conf.yaml @@ -26,13 +26,14 @@ paths: # these are big we tend to want them to be in a non-temporary but # .gitignored spot. The path is resolved relative to the root of the # docs repo. - repos: /tmp/repos/ + repos: --tmp--/repos/ # This configures all of the repositories used to build the docs repos: # Normally we use the `https://` prefix to clone from github but this file - # is for testing so we pick a repo on the filesystem. - source: /tmp/source + # is for testing so use a string that we can find with sed and replace with + # a file. + source: --tmp--/source # The title to use for the table of contents contents_title: Elastic Stack and Product Documentation @@ -44,10 +45,10 @@ contents: prefix: test current: master branches: [ master ] - index: minimal.asciidoc + index: index.asciidoc tags: test tag subject: Test sources: - repo: source - path: . + path: index.asciidoc diff --git a/integtest/two_repos_conf.yaml b/integtest/two_repos_conf.yaml new file mode 100644 index 0000000000000..da5b87600bcb8 --- /dev/null +++ b/integtest/two_repos_conf.yaml @@ -0,0 +1,46 @@ +# This conf file builds a book using /tmp/source1 and /tmp/source2. See +# small_conf.yaml for description of the sections. + +template: + path: .template/ + branch: + default: + base_url: 'https://www.elastic.co/' + template_url: 'https://www.elastic.co/guide_template' + staging: + base_url: 'https://stag-www.elastic.co/' + template_url: 'https://stag-www.elastic.co/guide_template' + defaults: + POSTHEAD: | + + FINAL: | + + + +paths: + build: html/ + branch_tracker: html/branches.yaml + repos: --tmp--/repos/ + +repos: + source1: --tmp--/source1 + source2: --tmp--/source2 + +contents_title: Elastic Stack and Product Documentation + +contents: + - + title: Test book + prefix: test + current: master + branches: [ master ] + index: docs/index.asciidoc + tags: test tag + subject: Test + sources: + - + repo: source1 + path: docs + - + repo: source2 + path: index.asciidoc diff --git a/lib/ES/Book.pm b/lib/ES/Book.pm index 325777384b34d..a11a8123941cb 100644 --- a/lib/ES/Book.pm +++ b/lib/ES/Book.pm @@ -237,7 +237,7 @@ sub _build_book { && !$template->md5_changed($branch_dir) && !$source->has_changed( $self->title, $branch, $self->asciidoctor ); - my ( $checkout, $edit_urls, $first_path ) = $source->prepare($branch); + my ( $checkout, $edit_urls, $first_path ) = $source->prepare($self->title, $branch); $pm->start($branch) and return; say " - Branch: $branch - Building..."; diff --git a/lib/ES/Repo.pm b/lib/ES/Repo.pm index fcac42a898c0d..2dbbec6e773a3 100644 --- a/lib/ES/Repo.pm +++ b/lib/ES/Repo.pm @@ -40,6 +40,8 @@ sub new { url => $url, tracker => $args{tracker}, reference_dir => $reference_dir, + keep_hash => $args{keep_hash}, + sub_dirs => {}, }, $class; if ( $self->tracker ) { # Only track repos that have a tracker. Other repos are for things like @@ -128,25 +130,36 @@ sub _reference_args { return (); } +#=================================== +sub add_sub_dir { +#=================================== + my ( $self, $branch, $dir ) = @_; + $self->{sub_dirs}->{$branch} = $dir; + return (); +} + #=================================== sub has_changed { #=================================== my $self = shift; my ( $title, $branch, $path, $asciidoctor ) = @_; - my $old - = $self->tracker->sha_for_branch( $self->name, - $self->_tracker_branch(@_) ) - or return 1; + return 1 if exists $self->{sub_dirs}->{$branch}; local $ENV{GIT_DIR} = $self->git_dir; - - my $new = sha_for($branch) - or die "Remote branch doesn't exist " - . "in repo " - . $self->name; + my $old = $self->_last_commit_info(@_) or return 1; + + my $new; + if ( $self->keep_hash ) { + $new = $self->_last_commit(@_); + } else { + $new = sha_for($branch) or die( + "Remote branch doesn't exist in repo " + . $self->name); + } $new .= '|asciidoctor' if $asciidoctor; + return $old ne $new if $self->keep_hash; return if $old eq $new; my $changed; @@ -165,42 +178,50 @@ sub mark_done { my $self = shift; my ( $title, $branch, $path, $asciidoctor ) = @_; - local $ENV{GIT_DIR} = $self->git_dir; - - my $new = sha_for($branch); + my $new; + if ( exists $self->{sub_dirs}->{$branch} ) { + $new = 'local'; + } elsif ( $self->keep_hash ) { + $new = $self->_last_commit($title, $branch, $path); + } else { + local $ENV{GIT_DIR} = $self->git_dir; + $new = sha_for($branch); + } $new .= '|asciidoctor' if $asciidoctor; + $self->tracker->set_sha_for_branch( $self->name, $self->_tracker_branch(@_), $new ); - } #=================================== -sub tree { +sub extract { #=================================== my $self = shift; - my ( $branch, $path ) = @_; - - local $ENV{GIT_DIR} = $self->git_dir; + my ( $title, $branch, $path, $dest ) = @_; + + if ( exists $self->{sub_dirs}->{$branch} ) { + # Copies the $path from the subsitution diretory. It is tempting to + # just symlink the substitution directoriy into the destionation and + # call it a day and that *almost* works! The trouble is that we often + # use relative paths to include asciidoc files from other repositories + # and those relative paths don't work at all with symlinks. + my $realpath = $self->{sub_dirs}->{$branch}->subdir($path); + my $realdest = $dest->subdir($path)->parent; + die "Can't find $realpath" unless -e $realpath; + $realdest->mkpath; + eval { + run qw(cp -r), $realpath, $realdest; + 1; + } or die "Error copying from $realpath: $@"; + return; + } - my @files; - eval { - @files = map { Path::Class::file($_) } split /\0/, - run( qw(git ls-tree -r --name-only -z), $branch, '--', $path ); - 1; - } or do { - my $error = $@; - die "Unknown branch <$branch> in repo <" . $self->name . ">" - if $error =~ /Not a valid object name/; - die $@; - }; - return @files; -} + if ( $self->keep_hash ) { + $branch = $self->_last_commit(@_); + die "--keep_hash can't be performed for new repos" unless $branch; + die "--keep_hash can't build on top of --sub_dir" if $branch eq 'local'; + } -#=================================== -sub extract { -#=================================== - my $self = shift; - my ( $branch, $path, $dest ) = @_; local $ENV{GIT_DIR} = $self->git_dir; $dest->mkpath; @@ -256,11 +277,16 @@ sub edit_url_for_url_and_branch { sub dump_recent_commits { #=================================== my ( $self, $title, $branch, $src_path ) = @_; - local $ENV{GIT_DIR} = $self->git_dir; - my $start = $self->tracker->sha_for_branch( $self->name, - $self->_tracker_branch( $title, $branch, $src_path ) ); - my $rev_range = "$start...$branch"; + my $description = $self->name . "/$title:$branch:$src_path"; + if ( exists $self->{sub_dirs}->{$branch} ) { + return "Used " . $self->{sub_dirs}->{$branch} . + " for $description\n"; + } + + local $ENV{GIT_DIR} = $self->git_dir; + my $start = $self->_last_commit( $title, $branch, $src_path ); + my $rev_range = $self->keep_hash ? $start : "$start...$branch"; my $commits = eval { decode_utf8 run( 'git', 'log', $rev_range, @@ -275,8 +301,7 @@ sub dump_recent_commits { '-n', 10, '--abbrev-commit', '--date=relative', '--', $src_path ); } - my $header - = "Recent commits in " . $self->name . "/$title:$branch:$src_path:"; + my $header = "Recent commits in $description"; return $header . "\n" . ( '-' x length($header) ) . "\n" @@ -300,8 +325,13 @@ sub all_repo_branches { for my $branch ( sort keys %$shas ) { my $sha = $shas->{$branch}; $sha =~ s/\|.+$//; # Strip |asciidoctor if it is in the hash - my $log = run( qw(git log --oneline -1), $sha ); - my ($msg) = ( $log =~ /^\w+\s+([^\n]+)/ ); + my $msg; + if ( $sha eq 'local' ) { + $msg = 'local changes'; + } else { + my $log = run( qw(git log --oneline -1), $sha ); + $msg = $log =~ /^\w+\s+([^\n]+)/; + } push @out, sprintf " %-35s %s %s", $branch, substr( $shas->{$branch}, 0, 8 ), $msg; } @@ -316,6 +346,7 @@ sub checkout_to { #=================================== my ( $self, $destination ) = @_; + die 'sub_dir not supported with checkout_to' if %{ $self->{sub_dirs}}; my $name = $self->name; eval { run qw(git clone), $self->git_dir, $destination; @@ -324,12 +355,35 @@ sub checkout_to { or die "Error checking out repo <$name>: $@"; } +#=================================== +# Information about the last commit, *not* including flags like `asciidoctor.` +#=================================== +sub _last_commit { +#=================================== + my $self = shift; + my $sha = $self->_last_commit_info(@_); + $sha =~ s/\|.+$//; # Strip |asciidoctor if it is in the hash + return $sha; +} + +#=================================== +# Information about the last commit, including flags like `asciidoctor.` +#=================================== +sub _last_commit_info { +#=================================== + my $self = shift; + my $tracker_branch = $self->_tracker_branch(@_); + my $sha = $self->tracker->sha_for_branch($self->name, $tracker_branch); + return $sha; +} + #=================================== sub name { shift->{name} } sub git_dir { shift->{git_dir} } sub url { shift->{url} } sub tracker { shift->{tracker} } sub reference_dir { shift->{reference_dir} } +sub keep_hash { shift->{keep_hash} } #=================================== 1 diff --git a/lib/ES/Source.pm b/lib/ES/Source.pm index c8b2b1c318527..8a048010adc0e 100644 --- a/lib/ES/Source.pm +++ b/lib/ES/Source.pm @@ -82,6 +82,7 @@ sub dump_recent_commits { sub prepare { #=================================== my $self = shift; + my $title = shift; my $branch = shift; my $checkout = Path::Class::tempdir( DIR => $self->temp_dir ); @@ -95,7 +96,7 @@ sub prepare { my $path = $source->{path}; my $source_checkout = $checkout->subdir($prefix); - $repo->extract( $branch, $path, $source_checkout ); + $repo->extract( $title, $branch, $path, $source_checkout ); $edit_urls{ $source_checkout->absolute } = $repo->edit_url($branch); $first_path = $source_checkout unless $first_path; }