eac_tools 0.86.0 → 0.86.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +54 -45
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/Gemfile +8 -0
- data/sub/avm/avm.gemspec +30 -0
- data/sub/avm/lib/avm/application_scms/base.rb +39 -0
- data/sub/avm/lib/avm/application_scms.rb +9 -0
- data/sub/avm/lib/avm/application_stereotypes/base.rb +31 -0
- data/sub/avm/lib/avm/application_stereotypes.rb +9 -0
- data/sub/avm/lib/avm/applications/base/auto_local_source_path.rb +24 -0
- data/sub/avm/lib/avm/applications/base/local_instance.rb +31 -0
- data/sub/avm/lib/avm/applications/base/local_source.rb +30 -0
- data/sub/avm/lib/avm/applications/base/naming.rb +28 -0
- data/sub/avm/lib/avm/applications/base/organization.rb +29 -0
- data/sub/avm/lib/avm/applications/base/publishing.rb +43 -0
- data/sub/avm/lib/avm/applications/base/scm.rb +27 -0
- data/sub/avm/lib/avm/applications/base/stereotype.rb +31 -0
- data/sub/avm/lib/avm/applications/base.rb +37 -0
- data/sub/avm/lib/avm/applications.rb +9 -0
- data/sub/avm/lib/avm/data/callbacks.rb +37 -0
- data/sub/avm/lib/avm/data/clearer.rb +20 -0
- data/sub/avm/lib/avm/data/dumper.rb +142 -0
- data/sub/avm/lib/avm/data/loader.rb +28 -0
- data/sub/avm/lib/avm/data/package/base_performer.rb +38 -0
- data/sub/avm/lib/avm/data/package/build_directory.rb +28 -0
- data/sub/avm/lib/avm/data/package/clear.rb +22 -0
- data/sub/avm/lib/avm/data/package/dump.rb +45 -0
- data/sub/avm/lib/avm/data/package/load.rb +36 -0
- data/sub/avm/lib/avm/data/package.rb +67 -0
- data/sub/avm/lib/avm/data/performer.rb +49 -0
- data/sub/avm/lib/avm/data/rotate.rb +107 -0
- data/sub/avm/lib/avm/data/unit.rb +49 -0
- data/sub/avm/lib/avm/data/unit_with_commands.rb +52 -0
- data/sub/avm/lib/avm/docker/container.rb +50 -0
- data/sub/avm/lib/avm/docker/image.rb +76 -0
- data/sub/avm/lib/avm/docker/runner.rb +121 -0
- data/sub/avm/lib/avm/docker.rb +9 -0
- data/sub/avm/lib/avm/entries/auto_values/entry.rb +39 -0
- data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +24 -0
- data/sub/avm/lib/avm/entries/auto_values.rb +11 -0
- data/sub/avm/lib/avm/entries/base/inherited_entry_value.rb +46 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/default_value.rb +28 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/inherited_value.rb +39 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/url_entry_value.rb +31 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value.rb +44 -0
- data/sub/avm/lib/avm/entries/base/uri_components_entries_values/component_factory.rb +42 -0
- data/sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb +63 -0
- data/sub/avm/lib/avm/entries/base/uri_components_entries_values/path_component.rb +19 -0
- data/sub/avm/lib/avm/entries/base/uri_components_entries_values/url_component.rb +28 -0
- data/sub/avm/lib/avm/entries/base/uri_components_entries_values.rb +25 -0
- data/sub/avm/lib/avm/entries/base.rb +46 -0
- data/sub/avm/lib/avm/entries/entry.rb +65 -0
- data/sub/avm/lib/avm/entries/jobs/base.rb +62 -0
- data/sub/avm/lib/avm/entries/jobs/variables_source/read_entry.rb +50 -0
- data/sub/avm/lib/avm/entries/jobs/variables_source.rb +15 -0
- data/sub/avm/lib/avm/entries/jobs/with_variables_source.rb +15 -0
- data/sub/avm/lib/avm/entries/jobs.rb +11 -0
- data/sub/avm/lib/avm/entries/keys_constants_set.rb +43 -0
- data/sub/avm/lib/avm/entries/uri_builder.rb +91 -0
- data/sub/avm/lib/avm/entries.rb +9 -0
- data/sub/avm/lib/avm/executables.rb +24 -0
- data/sub/avm/lib/avm/file_formats/base.rb +35 -0
- data/sub/avm/lib/avm/file_formats/file_result.rb +13 -0
- data/sub/avm/lib/avm/file_formats/search_formatter.rb +87 -0
- data/sub/avm/lib/avm/file_formats/unknown.rb +18 -0
- data/sub/avm/lib/avm/file_formats/utf8_assert.rb +72 -0
- data/sub/avm/lib/avm/file_formats.rb +9 -0
- data/sub/avm/lib/avm/instances/base/auto_values/data.rb +25 -0
- data/sub/avm/lib/avm/instances/base/auto_values/database.rb +62 -0
- data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +35 -0
- data/sub/avm/lib/avm/instances/base/auto_values/source.rb +15 -0
- data/sub/avm/lib/avm/instances/base/auto_values.rb +14 -0
- data/sub/avm/lib/avm/instances/base/dockerizable.rb +45 -0
- data/sub/avm/lib/avm/instances/base/entry_keys.rb +27 -0
- data/sub/avm/lib/avm/instances/base/install.rb +24 -0
- data/sub/avm/lib/avm/instances/base/processes.rb +27 -0
- data/sub/avm/lib/avm/instances/base/subcommand_parent.rb +25 -0
- data/sub/avm/lib/avm/instances/base/web.rb +16 -0
- data/sub/avm/lib/avm/instances/base.rb +71 -0
- data/sub/avm/lib/avm/instances/data/files_unit.rb +59 -0
- data/sub/avm/lib/avm/instances/data/package.rb +27 -0
- data/sub/avm/lib/avm/instances/data/unit.rb +30 -0
- data/sub/avm/lib/avm/instances/data.rb +11 -0
- data/sub/avm/lib/avm/instances/docker_image.rb +15 -0
- data/sub/avm/lib/avm/instances/entry_keys.rb +43 -0
- data/sub/avm/lib/avm/instances/ids.rb +30 -0
- data/sub/avm/lib/avm/instances/process.rb +31 -0
- data/sub/avm/lib/avm/instances/runner.rb +37 -0
- data/sub/avm/lib/avm/instances.rb +9 -0
- data/sub/avm/lib/avm/launcher/context/instance_collector.rb +46 -0
- data/sub/avm/lib/avm/launcher/context/instance_discovery.rb +56 -0
- data/sub/avm/lib/avm/launcher/context/instance_manager/cached_instance.rb +37 -0
- data/sub/avm/lib/avm/launcher/context/instance_manager/cached_instances.rb +35 -0
- data/sub/avm/lib/avm/launcher/context/instance_manager.rb +77 -0
- data/sub/avm/lib/avm/launcher/context/settings.rb +53 -0
- data/sub/avm/lib/avm/launcher/context.rb +100 -0
- data/sub/avm/lib/avm/launcher/errors/base.rb +10 -0
- data/sub/avm/lib/avm/launcher/errors/non_project.rb +15 -0
- data/sub/avm/lib/avm/launcher/errors.rb +11 -0
- data/sub/avm/lib/avm/launcher/instances/base/cache.rb +43 -0
- data/sub/avm/lib/avm/launcher/instances/base/publishing.rb +53 -0
- data/sub/avm/lib/avm/launcher/instances/base.rb +78 -0
- data/sub/avm/lib/avm/launcher/instances/error.rb +10 -0
- data/sub/avm/lib/avm/launcher/instances/runner_helper.rb +47 -0
- data/sub/avm/lib/avm/launcher/instances/settings.rb +26 -0
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0 → avm/lib/avm/launcher}/instances.rb +1 -1
- data/sub/avm/lib/avm/launcher/paths/logical.rb +80 -0
- data/sub/avm/lib/avm/launcher/paths/real.rb +44 -0
- data/sub/avm/lib/avm/launcher/paths.rb +11 -0
- data/sub/avm/lib/avm/launcher/project.rb +17 -0
- data/sub/avm/lib/avm/launcher/publish/base.rb +47 -0
- data/sub/avm/lib/avm/launcher/publish/check_result.rb +65 -0
- data/sub/avm/lib/avm/launcher/publish.rb +11 -0
- data/sub/avm/lib/avm/launcher/stereotype.rb +63 -0
- data/sub/avm/lib/avm/launcher.rb +9 -0
- data/sub/avm/lib/avm/launcher_stereotypes.rb +9 -0
- data/sub/avm/lib/avm/patches/eac_config/entry_path.rb +46 -0
- data/sub/avm/lib/avm/path_string.rb +27 -0
- data/sub/avm/lib/avm/registry/application_scms.rb +15 -0
- data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +49 -0
- data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +33 -0
- data/sub/avm/lib/avm/registry/application_stereotypes.rb +52 -0
- data/sub/avm/lib/avm/registry/applications.rb +38 -0
- data/sub/avm/lib/avm/registry/config_objects.rb +18 -0
- data/sub/avm/lib/avm/registry/file_formats.rb +20 -0
- data/sub/avm/lib/avm/registry/from_gems.rb +80 -0
- data/sub/avm/lib/avm/registry/instances.rb +16 -0
- data/sub/avm/lib/avm/registry/launcher_stereotypes.rb +11 -0
- data/sub/avm/lib/avm/registry/runners.rb +10 -0
- data/sub/avm/lib/avm/registry/scms.rb +10 -0
- data/sub/avm/lib/avm/registry/source_generators.rb +17 -0
- data/sub/avm/lib/avm/registry/sources.rb +31 -0
- data/sub/avm/lib/avm/registry/with_path/cache.rb +31 -0
- data/sub/avm/lib/avm/registry/with_path.rb +49 -0
- data/sub/avm/lib/avm/registry.rb +35 -0
- data/sub/avm/lib/avm/result.rb +82 -0
- data/sub/avm/lib/avm/rspec/setup/launcher.rb +20 -0
- data/sub/avm/lib/avm/rspec/setup/source_generator.rb +22 -0
- data/sub/avm/lib/avm/rspec/setup.rb +35 -0
- data/sub/avm/lib/avm/rspec/shared_examples/avm_file_format_file_resource_name.rb +15 -0
- data/sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb +31 -0
- data/sub/avm/lib/avm/rspec/shared_examples/avm_source_generated.rb +23 -0
- data/sub/avm/lib/avm/rspec/shared_examples/entries_values.rb +23 -0
- data/sub/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb +11 -0
- data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +14 -0
- data/sub/avm/lib/avm/rspec.rb +9 -0
- data/sub/avm/lib/avm/runners/base.rb +27 -0
- data/sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb +39 -0
- data/sub/avm/lib/avm/scms/auto_commit/for_file.rb +82 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/base.rb +40 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/last.rb +19 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/manual.rb +40 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/new.rb +24 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/nth.rb +31 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules/unique.rb +21 -0
- data/sub/avm/lib/avm/scms/auto_commit/rules.rb +36 -0
- data/sub/avm/lib/avm/scms/auto_commit.rb +11 -0
- data/sub/avm/lib/avm/scms/base/branches.rb +22 -0
- data/sub/avm/lib/avm/scms/base/commits.rb +34 -0
- data/sub/avm/lib/avm/scms/base/milestones.rb +21 -0
- data/sub/avm/lib/avm/scms/base/remotes.rb +22 -0
- data/sub/avm/lib/avm/scms/base.rb +56 -0
- data/sub/avm/lib/avm/scms/branch.rb +26 -0
- data/sub/avm/lib/avm/scms/changed_file.rb +26 -0
- data/sub/avm/lib/avm/scms/commit.rb +66 -0
- data/sub/avm/lib/avm/scms/commit_info.rb +39 -0
- data/sub/avm/lib/avm/scms/inflector.rb +22 -0
- data/sub/avm/lib/avm/scms/interval.rb +18 -0
- data/sub/avm/lib/avm/scms/null/commit.rb +15 -0
- data/sub/avm/lib/avm/scms/null.rb +21 -0
- data/sub/avm/lib/avm/scms/remote.rb +11 -0
- data/sub/avm/lib/avm/scms.rb +9 -0
- data/sub/avm/lib/avm/self/docker_image.rb +14 -0
- data/sub/avm/lib/avm/self/instance/entry_keys.rb +12 -0
- data/sub/avm/lib/avm/self/instance.rb +31 -0
- data/sub/avm/lib/avm/source_generators/base.rb +45 -0
- data/sub/avm/lib/avm/source_generators/option.rb +11 -0
- data/sub/avm/lib/avm/source_generators/option_list.rb +32 -0
- data/sub/avm/lib/avm/source_generators/runner.rb +58 -0
- data/sub/avm/lib/avm/source_generators.rb +9 -0
- data/sub/avm/lib/avm/sources/auto_commit/for_file.rb +31 -0
- data/sub/avm/lib/avm/sources/auto_commit.rb +11 -0
- data/sub/avm/lib/avm/sources/base/application.rb +34 -0
- data/sub/avm/lib/avm/sources/base/configuration.rb +92 -0
- data/sub/avm/lib/avm/sources/base/instance.rb +16 -0
- data/sub/avm/lib/avm/sources/base/locale.rb +33 -0
- data/sub/avm/lib/avm/sources/base/organizational.rb +32 -0
- data/sub/avm/lib/avm/sources/base/parent.rb +28 -0
- data/sub/avm/lib/avm/sources/base/stereotype.rb +18 -0
- data/sub/avm/lib/avm/sources/base/sub/remove.rb +38 -0
- data/sub/avm/lib/avm/sources/base/sub.rb +26 -0
- data/sub/avm/lib/avm/sources/base/subs.rb +67 -0
- data/sub/avm/lib/avm/sources/base/subs_paths.rb +32 -0
- data/sub/avm/lib/avm/sources/base/testing.rb +70 -0
- data/sub/avm/lib/avm/sources/base/update.rb +39 -0
- data/sub/avm/lib/avm/sources/base/update_sub.rb +57 -0
- data/sub/avm/lib/avm/sources/base/update_subs.rb +19 -0
- data/sub/avm/lib/avm/sources/base/version_bump.rb +29 -0
- data/sub/avm/lib/avm/sources/base.rb +51 -0
- data/sub/avm/lib/avm/sources/configuration/rubocop.rb +26 -0
- data/sub/avm/lib/avm/sources/configuration.rb +59 -0
- data/sub/avm/lib/avm/sources/issues/deliver.rb +52 -0
- data/sub/avm/lib/avm/sources/issues.rb +11 -0
- data/sub/avm/lib/avm/sources/runner.rb +40 -0
- data/sub/avm/lib/avm/sources/tests/builder.rb +96 -0
- data/sub/avm/lib/avm/sources/tests/performer.rb +35 -0
- data/sub/avm/lib/avm/sources/tests/result.rb +15 -0
- data/sub/avm/lib/avm/sources/tests/single.rb +75 -0
- data/sub/avm/lib/avm/sources/tests.rb +11 -0
- data/sub/avm/lib/avm/sources/update_error.rb +8 -0
- data/sub/avm/lib/avm/sources.rb +9 -0
- data/sub/avm/lib/avm/sync.rb +94 -0
- data/sub/avm/lib/avm/version.rb +5 -0
- data/sub/avm/lib/avm/version_number.rb +45 -0
- data/sub/avm/lib/avm/with/application_stereotype.rb +33 -0
- data/sub/avm/lib/avm/with/extra_subcommands.rb +44 -0
- data/sub/avm/lib/avm.rb +7 -0
- data/sub/avm/locale/en.yml +6 -0
- data/sub/avm/locale/pt-BR.yml +6 -0
- data/sub/avm/spec/lib/avm/applications/base/entries_spec.rb +31 -0
- data/sub/avm/spec/lib/avm/applications/base/entries_spec_files/config.yml +12 -0
- data/sub/avm/spec/lib/avm/applications/base_spec.rb +23 -0
- data/sub/avm/spec/lib/avm/applications/base_spec_fixture.yml +3 -0
- data/sub/avm/spec/lib/avm/file_formats/base_spec.rb +11 -0
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +107 -0
- data/sub/avm/spec/lib/avm/instances/base_spec_files/config.yml +50 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec.rb +43 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/avm-tools.gemspec +29 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/lib/avm/tools/version.rb +7 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/lib/avm/tools.rb +6 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub/version.rb +5 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub.rb +3 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec +16 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/settings.yaml +5 -0
- data/sub/avm/spec/lib/avm/patches/eac_config/entry_path_spec.rb +28 -0
- data/sub/avm/spec/lib/avm/scms/auto_commit/file_resource_name_spec.rb +21 -0
- data/sub/avm/spec/lib/avm/scms/base_spec.rb +7 -0
- data/sub/avm/spec/lib/avm/sources/base_spec.rb +7 -0
- data/sub/avm/spec/lib/avm/sources/runner_spec.rb +9 -0
- data/sub/avm/spec/rubocop_spec.rb +3 -0
- data/sub/avm/spec/spec_helper.rb +4 -0
- data/sub/avm-git/Gemfile +8 -0
- data/sub/avm-git/avm-git.gemspec +23 -0
- data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +49 -0
- data/sub/avm-git/lib/avm/git/application_scms/base.rb +21 -0
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0/sources.rb → avm-git/lib/avm/git/application_scms.rb} +2 -2
- data/sub/avm-git/lib/avm/git/commit/class_methods.rb +31 -0
- data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +32 -0
- data/sub/avm-git/lib/avm/git/commit/file.rb +46 -0
- data/sub/avm-git/lib/avm/git/commit.rb +59 -0
- data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +42 -0
- data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +23 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +61 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/push.rb +60 -0
- data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +33 -0
- data/sub/avm-git/lib/avm/git/issue/complete/test.rb +40 -0
- data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +28 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +53 -0
- data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +19 -0
- data/sub/avm-git/lib/avm/git/issue/complete.rb +66 -0
- data/sub/avm-git/lib/avm/git/issue.rb +11 -0
- data/sub/avm-git/lib/avm/git/launcher/base/class_methods.rb +28 -0
- data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +23 -0
- data/sub/avm-git/lib/avm/git/launcher/base/remotes.rb +40 -0
- data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +44 -0
- data/sub/avm-git/lib/avm/git/launcher/base/underlying.rb +59 -0
- data/sub/avm-git/lib/avm/git/launcher/base.rb +87 -0
- data/sub/avm-git/lib/avm/git/launcher/error.rb +15 -0
- data/sub/avm-git/lib/avm/git/launcher/mirror_update.rb +38 -0
- data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +131 -0
- data/sub/avm-git/lib/avm/git/launcher/remote.rb +55 -0
- data/sub/avm-git/lib/avm/git/launcher/sub_warp_base.rb +33 -0
- data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +68 -0
- data/sub/avm-git/lib/avm/git/launcher.rb +7 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb +19 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/publish.rb +15 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/warp.rb +27 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git.rb +25 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb +31 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +88 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb +36 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/publish.rb +14 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/warp.rb +32 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb +51 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/provider.rb +22 -0
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0/file_formats.rb → avm-git/lib/avm/git/launcher_stereotypes.rb} +2 -2
- data/sub/avm-git/lib/avm/git/organize/reference_update.rb +34 -0
- data/sub/avm-git/lib/avm/git/organize/repository.rb +77 -0
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0/source_generators.rb → avm-git/lib/avm/git/organize.rb} +2 -2
- data/sub/avm-git/lib/avm/git/revision_test.rb +105 -0
- data/sub/avm-git/lib/avm/git/scms/git/branch.rb +31 -0
- data/sub/avm-git/lib/avm/git/scms/git/branches.rb +20 -0
- data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +36 -0
- data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +16 -0
- data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +24 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb +43 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb +30 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +67 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb +36 -0
- data/sub/avm-git/lib/avm/git/scms/git/commits.rb +47 -0
- data/sub/avm-git/lib/avm/git/scms/git/interval.rb +31 -0
- data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git/remote.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git/remotes.rb +32 -0
- data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +57 -0
- data/sub/avm-git/lib/avm/git/scms/git.rb +44 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/changed_file.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/commit.rb +27 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/interval.rb +28 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base.rb +33 -0
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +37 -0
- data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +26 -0
- data/sub/avm-git/lib/avm/git/scms/provider.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms.rb +11 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/parent.rb +51 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/remote.rb +89 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +32 -0
- data/sub/avm-git/lib/avm/git/subrepo_check.rb +38 -0
- data/sub/avm-git/lib/avm/git/subrepo_checks.rb +60 -0
- data/sub/avm-git/lib/avm/git/vendor/github.rb +20 -0
- data/sub/avm-git/lib/avm/git/vendor.rb +11 -0
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0 → avm-git/lib/avm/git}/version.rb +2 -2
- data/sub/{avm-eac_php_base0/lib/avm/eac_php_base0.rb → avm-git/lib/avm/git.rb} +1 -1
- data/sub/avm-git/locale/en.yml +6 -0
- data/sub/avm-git/locale/pt-BR.yml +6 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +56 -0
- data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +45 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +92 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +8 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +8 -0
- data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +23 -0
- data/sub/avm-git/spec/rubocop_spec.rb +3 -0
- data/sub/avm-git/spec/spec_helper.rb +4 -0
- data/sub/avm-tools/avm-tools.gemspec +3 -3
- data/sub/avm-tools/lib/avm/tools/runner/source/issue/deliver.rb +3 -3
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_git/Gemfile +8 -0
- data/sub/eac_git/eac_git.gemspec +20 -0
- data/sub/eac_git/lib/eac_git/executables.rb +48 -0
- data/sub/eac_git/lib/eac_git/local/branch.rb +47 -0
- data/sub/eac_git/lib/eac_git/local/commit/archive.rb +19 -0
- data/sub/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
- data/sub/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
- data/sub/eac_git/lib/eac_git/local/commit.rb +73 -0
- data/sub/eac_git/lib/eac_git/local/dirty_files.rb +48 -0
- data/sub/eac_git/lib/eac_git/local/log.rb +17 -0
- data/sub/eac_git/lib/eac_git/local/remote/push.rb +35 -0
- data/sub/eac_git/lib/eac_git/local/remote.rb +50 -0
- data/sub/eac_git/lib/eac_git/local/remotes.rb +20 -0
- data/sub/eac_git/lib/eac_git/local/subrepo/config.rb +43 -0
- data/sub/eac_git/lib/eac_git/local/subrepo.rb +49 -0
- data/sub/eac_git/lib/eac_git/local.rb +127 -0
- data/sub/eac_git/lib/eac_git/remote.rb +24 -0
- data/sub/eac_git/lib/eac_git/remote_like/ls_result.rb +20 -0
- data/sub/eac_git/lib/eac_git/remote_like.rb +32 -0
- data/sub/eac_git/lib/eac_git/rspec/setup.rb +23 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/directory.rb +36 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/file.rb +22 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/fs_object.rb +27 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/repository.rb +34 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb +29 -0
- data/sub/eac_git/lib/eac_git/rspec.rb +9 -0
- data/sub/eac_git/lib/eac_git/version.rb +5 -0
- data/sub/eac_git/lib/eac_git.rb +7 -0
- data/sub/eac_git/spec/lib/eac_git/executables_spec.rb +13 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/sub/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
- data/sub/eac_git/spec/lib/eac_git/local/dirty_files_spec.rb +20 -0
- data/sub/eac_git/spec/rubocop_spec.rb +3 -0
- data/sub/eac_git/spec/spec_helper.rb +4 -0
- data/sub/eac_git/vendor/git-subrepo/Changes +110 -0
- data/sub/eac_git/vendor/git-subrepo/Intro.pod +509 -0
- data/sub/eac_git/vendor/git-subrepo/License +21 -0
- data/sub/eac_git/vendor/git-subrepo/Makefile +82 -0
- data/sub/eac_git/vendor/git-subrepo/Meta +28 -0
- data/sub/eac_git/vendor/git-subrepo/ReadMe.pod +698 -0
- data/sub/eac_git/vendor/git-subrepo/doc/comparison.swim +35 -0
- data/sub/eac_git/vendor/git-subrepo/doc/git-subrepo.swim +608 -0
- data/sub/eac_git/vendor/git-subrepo/doc/intro-to-subrepo.swim +387 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/Changes +15 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/License +21 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/Makefile +45 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/Meta +28 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/ReadMe.pod +77 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/bin/bash+ +43 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/doc/bash+.swim +61 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/lib/bash+.bash +92 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/man/man1/bash+.1 +134 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/man/man3/bash+.3 +134 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/base.t +12 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/fcopy.t +22 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/lib/foo/bar.bash +3 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/lib/foo/foo.bash +3 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/source-bash+-std.t +18 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/source-bash+.t +23 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/test.bash +70 -0
- data/sub/eac_git/vendor/git-subrepo/ext/bashplus/test/use.t +19 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/Changes +15 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/License +21 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/Makefile +20 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/Meta +30 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ReadMe.pod +115 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/doc/test-more.swim +89 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Changes +15 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/License +21 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Makefile +45 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Meta +28 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/ReadMe.pod +77 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/bin/bash+ +43 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/doc/bash+.swim +61 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/lib/bash+.bash +92 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man1/bash+.1 +134 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man3/bash+.3 +134 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/base.t +12 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/fcopy.t +22 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/lib/foo/bar.bash +3 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/lib/foo/foo.bash +3 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+-std.t +18 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+.t +23 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/test.bash +70 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/use.t +19 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Changes +15 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/License +21 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Makefile +37 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Meta +28 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/ReadMe.pod +66 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/doc/test-tap.swim +48 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/lib/test/tap.bash +153 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/man/man3/test-tap.3 +119 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/bail_out.t +13 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/done.t +10 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail.t +20 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail_fast.t +15 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/helper.bash +9 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/pass.t +9 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/plan.t +10 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/skip_all.t +20 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/tap.t +13 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/bail.t +14 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/fail.t +7 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/fail_fast.t +12 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/skip-all-init.t +8 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/skip-all-plan.t +9 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/lib/test/more.bash +95 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/man/man3/test-more.3 +173 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/fail.t +20 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/more.t +20 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/pass.t +9 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/setup +8 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/skip_all.t +11 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/test/fail1.t +12 -0
- data/sub/eac_git/vendor/git-subrepo/ext/test-more-bash/test/test/skip_all.t +10 -0
- data/sub/eac_git/vendor/git-subrepo/lib/git-subrepo +1903 -0
- data/sub/eac_git/vendor/git-subrepo/lib/git-subrepo.d/bash+.bash +1 -0
- data/sub/eac_git/vendor/git-subrepo/lib/git-subrepo.d/help-functions.bash +339 -0
- data/sub/eac_git/vendor/git-subrepo/man/man1/git-subrepo.1 +743 -0
- data/sub/eac_git/vendor/git-subrepo/note/0.4.0 +12 -0
- data/sub/eac_git/vendor/git-subrepo/note/AllGitCmds +148 -0
- data/sub/eac_git/vendor/git-subrepo/note/Cases +32 -0
- data/sub/eac_git/vendor/git-subrepo/note/Commands +33 -0
- data/sub/eac_git/vendor/git-subrepo/note/Dags +199 -0
- data/sub/eac_git/vendor/git-subrepo/note/Gists +7 -0
- data/sub/eac_git/vendor/git-subrepo/note/Links +25 -0
- data/sub/eac_git/vendor/git-subrepo/note/Plugins +10 -0
- data/sub/eac_git/vendor/git-subrepo/note/Spec +39 -0
- data/sub/eac_git/vendor/git-subrepo/note/Story1 +57 -0
- data/sub/eac_git/vendor/git-subrepo/note/ToDo +55 -0
- data/sub/eac_git/vendor/git-subrepo/note/design.swim +137 -0
- data/sub/eac_git/vendor/git-subrepo/note/design2.swim +85 -0
- data/sub/eac_git/vendor/git-subrepo/note/init-test +38 -0
- data/sub/eac_git/vendor/git-subrepo/note/pull-dance.txt +18 -0
- data/sub/eac_git/vendor/git-subrepo/note/recreate-rebase-conflict.sh +56 -0
- data/sub/eac_git/vendor/git-subrepo/note/subtree-rebase-fail-example/test.bash +29 -0
- data/sub/eac_git/vendor/git-subrepo/note/test-subrepo-push.sh +69 -0
- data/sub/eac_git/vendor/git-subrepo/note/test.sh +58 -0
- data/sub/eac_git/vendor/git-subrepo/pkg/bin/generate-completion.pl +210 -0
- data/sub/eac_git/vendor/git-subrepo/pkg/bin/generate-help-functions.pl +89 -0
- data/sub/eac_git/vendor/git-subrepo/share/completion.bash +42 -0
- data/sub/eac_git/vendor/git-subrepo/share/enable-completion.sh +50 -0
- data/sub/eac_git/vendor/git-subrepo/share/git-completion.bash +2738 -0
- data/sub/eac_git/vendor/git-subrepo/share/zsh-completion/_git-subrepo +81 -0
- data/sub/eac_git/vendor/git-subrepo/test/branch-all.t +41 -0
- data/sub/eac_git/vendor/git-subrepo/test/branch-rev-list-one-path.t +43 -0
- data/sub/eac_git/vendor/git-subrepo/test/branch-rev-list.t +47 -0
- data/sub/eac_git/vendor/git-subrepo/test/branch.t +52 -0
- data/sub/eac_git/vendor/git-subrepo/test/clean.t +43 -0
- data/sub/eac_git/vendor/git-subrepo/test/clone-annotated-tag.t +45 -0
- data/sub/eac_git/vendor/git-subrepo/test/clone.t +107 -0
- data/sub/eac_git/vendor/git-subrepo/test/compile.t +19 -0
- data/sub/eac_git/vendor/git-subrepo/test/config.t +58 -0
- data/sub/eac_git/vendor/git-subrepo/test/encode.t +91 -0
- data/sub/eac_git/vendor/git-subrepo/test/error.t +171 -0
- data/sub/eac_git/vendor/git-subrepo/test/fetch.t +43 -0
- data/sub/eac_git/vendor/git-subrepo/test/gitignore.t +61 -0
- data/sub/eac_git/vendor/git-subrepo/test/init.t +64 -0
- data/sub/eac_git/vendor/git-subrepo/test/issue29.t +98 -0
- data/sub/eac_git/vendor/git-subrepo/test/issue95.t +98 -0
- data/sub/eac_git/vendor/git-subrepo/test/issue96.t +96 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-all.t +38 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-merge.t +113 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-message.t +88 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-new-branch.t +58 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-ours.t +90 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-theirs.t +82 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-twice.t +44 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull-worktree.t +40 -0
- data/sub/eac_git/vendor/git-subrepo/test/pull.t +99 -0
- data/sub/eac_git/vendor/git-subrepo/test/push-after-init.t +51 -0
- data/sub/eac_git/vendor/git-subrepo/test/push-force.t +56 -0
- data/sub/eac_git/vendor/git-subrepo/test/push-new-branch.t +61 -0
- data/sub/eac_git/vendor/git-subrepo/test/push-no-changes.t +29 -0
- data/sub/eac_git/vendor/git-subrepo/test/push-squash.t +56 -0
- data/sub/eac_git/vendor/git-subrepo/test/push.t +176 -0
- data/sub/eac_git/vendor/git-subrepo/test/reclone.t +45 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/HEAD +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/config +4 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/1f/0c4b264caed0126814a0ede851a1e0b4e16ae6 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/87/46903fdb1b9c2101377880125917c2e05b4d69 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/94/c86ffc745232d89f78c6f895e11e71272518db +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/c6/76c57b6576743fa56278527aa60ebd2e202a7c +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/objects/f6/2a8ff3feadf39b0a98f1a86ec6d1eb33858ee9 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/refs/heads/master +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/bar/refs/tags/A +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/HEAD +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/config +4 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/objects/a0/f4cdaaf533a936296cdebbed8206c3b9ededa8 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/objects/e2/1291a1ad392a9d4c51dd9586804f1467b28afd +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/foo/refs/heads/master +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/HEAD +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/config +5 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/11/523f5dcf03b4c89b592dc8a3d0308f68da2386 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/14/2addf8ec5f37334e837440122c62f2c68a29ad +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/32/5180321750a21cd7a4e7ecda319e557a4f6a09 +2 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/3d/918c6901c02f43af5d31779dd5e1f9166aeb36 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/3e/4cb596066dce63ba4d047abddb677389b65e19 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/4b/6e53022e7a04f07887697e4f3d7c377fd9822b +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/58/931fc1bd559b59c41ea738fc7ad04f9ad01bd3 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/5e/c0c28e1b806f25efdca18fcf7a74b49c3755bd +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/75/fa6584e748f57eff06eebdc55e9ac21d4fcbf2 +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/80/2d5edbd5e1cb7fca82b5bd38e7c8a0a496fb20 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/94/7b3d714c38791e95ad6f928b48c98bb8708acd +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/95/e1f2df3f4d5f3d7a60588c25a7ca8a913d3c2a +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/b1/5f4a7666baf40d949548ead946a3370e273479 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/c3/ee8978c4c5d84c3b7d00ba8e5906933d027882 +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/c8/b0bffbc405ef3fad7354ff833fbec36d67ddfa +3 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/dd/8bdb934ec848137f011fe423b185505c343626 +2 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/e2/9be58c767cfeb27235c995d293a7d71aac0135 +2 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/ee/1224401fc6aac595145fa727dcf6706ac8aec1 +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/objects/f1/cc1a657b2e805c400f5dcaaa76bd29c6178b1b +0 -0
- data/sub/eac_git/vendor/git-subrepo/test/repo/init/refs/heads/master +1 -0
- data/sub/eac_git/vendor/git-subrepo/test/setup +205 -0
- data/sub/eac_git/vendor/git-subrepo/test/status.t +68 -0
- data/sub/eac_git/vendor/git-subrepo/test/submodule.t +45 -0
- metadata +586 -42
- data/sub/avm-eac_php_base0/Gemfile +0 -8
- data/sub/avm-eac_php_base0/avm-eac_php_base0.gemspec +0 -20
- data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/executables.rb +0 -22
- data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/file_formats/base.rb +0 -20
- data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/instances/base.rb +0 -13
- data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/source_generators/base.rb +0 -28
- data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/sources/base.rb +0 -17
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec.rb +0 -7
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_code.php.source +0 -10
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_code.php.target +0 -10
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_code2.php.source +0 -4
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_code2.php.target +0 -3
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_html_code.php.source +0 -64
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_html_code.php.target +0 -64
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_iso88591_code.php.source +0 -4
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_iso88591_code.php.target +0 -3
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec.rb +0 -8
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec_files/no_options/index.php +0 -0
- data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/sources/base_spec.rb +0 -7
- data/sub/avm-eac_php_base0/spec/rubocop_spec.rb +0 -3
- data/sub/avm-eac_php_base0/spec/spec_helper.rb +0 -4
- data/sub/avm-eac_php_base0/template/avm/eac_php_base0/source_generators/base/index.php +0 -0
@@ -0,0 +1,1903 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
#
|
4
|
+
# Copyright 2013-2020 - Ingy döt Net <ingy@ingy.net>
|
5
|
+
#
|
6
|
+
|
7
|
+
|
8
|
+
# Exit on any errors:
|
9
|
+
set -e
|
10
|
+
|
11
|
+
export FILTER_BRANCH_SQUELCH_WARNING=1
|
12
|
+
|
13
|
+
# Import Bash+ helper functions:
|
14
|
+
SOURCE="$BASH_SOURCE"
|
15
|
+
while [[ -h $SOURCE ]]; do
|
16
|
+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
17
|
+
SOURCE="$(readlink "$SOURCE")"
|
18
|
+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
19
|
+
done
|
20
|
+
SOURCE_DIR="$(dirname "$SOURCE")"
|
21
|
+
|
22
|
+
if [[ -z "$GIT_SUBREPO_ROOT" ]]; then
|
23
|
+
# If `make install` installation used:
|
24
|
+
source "${SOURCE_DIR}/git-subrepo.d/bash+.bash"
|
25
|
+
else
|
26
|
+
# If `source .rc` method used:
|
27
|
+
source "${SOURCE_DIR}/../ext/bashplus/lib/bash+.bash"
|
28
|
+
fi
|
29
|
+
bash+:import :std can
|
30
|
+
|
31
|
+
VERSION=0.4.1
|
32
|
+
REQUIRED_GIT_VERSION=2.7.0
|
33
|
+
GIT_TMP="$(git rev-parse --git-common-dir 2> /dev/null || echo .git)/tmp"
|
34
|
+
|
35
|
+
# `git rev-parse` turns this into a getopt parser and a command usage message:
|
36
|
+
GETOPT_SPEC="\
|
37
|
+
git subrepo <command> <arguments> <options>
|
38
|
+
|
39
|
+
Commands:
|
40
|
+
clone Clone a remote repository into a local subdirectory
|
41
|
+
init Turn a current subdirectory into a subrepo
|
42
|
+
pull Pull upstream changes to the subrepo
|
43
|
+
push Push local subrepo changes upstream
|
44
|
+
|
45
|
+
fetch Fetch a subrepo's remote branch (and create a ref for it)
|
46
|
+
branch Create a branch containing the local subrepo commits
|
47
|
+
commit Commit a merged subrepo branch into the mainline
|
48
|
+
|
49
|
+
status Get status of a subrepo (or all of them)
|
50
|
+
clean Remove branches, remotes and refs for a subrepo
|
51
|
+
config Set subrepo configuration properties
|
52
|
+
|
53
|
+
help Documentation for git-subrepo (or specific command)
|
54
|
+
version Display git-subrepo version info
|
55
|
+
upgrade Upgrade the git-subrepo software itself
|
56
|
+
|
57
|
+
See 'git help subrepo' for complete documentation and usage of each command.
|
58
|
+
|
59
|
+
Options:
|
60
|
+
--
|
61
|
+
h Show the command summary
|
62
|
+
help Help overview
|
63
|
+
version Print the git-subrepo version number
|
64
|
+
|
65
|
+
a,all Perform command on all current subrepos
|
66
|
+
A,ALL Perform command on all subrepos and subsubrepos
|
67
|
+
b,branch= Specify the upstream branch to push/pull/fetch
|
68
|
+
e,edit Edit commit message
|
69
|
+
f,force Force certain operations
|
70
|
+
F,fetch Fetch the upstream content first
|
71
|
+
M,method= Method when you join, valid options are 'merge' or 'rebase'
|
72
|
+
Default is 'merge'
|
73
|
+
m,message= Specify a commit message
|
74
|
+
r,remote= Specify the upstream remote to push/pull/fetch
|
75
|
+
s,squash Squash commits on push
|
76
|
+
u,update Add the --branch and/or --remote overrides to .gitrepo
|
77
|
+
|
78
|
+
q,quiet Show minimal output
|
79
|
+
v,verbose Show verbose output
|
80
|
+
d,debug Show the actual commands used
|
81
|
+
x,DEBUG Turn on -x Bash debugging
|
82
|
+
"
|
83
|
+
|
84
|
+
#------------------------------------------------------------------------------
|
85
|
+
# Top level function:
|
86
|
+
#------------------------------------------------------------------------------
|
87
|
+
main() {
|
88
|
+
# Define global variables:
|
89
|
+
local command= # Subrepo subcommand to run
|
90
|
+
local command_arguments=() # Command args after getopt parsing
|
91
|
+
local commit_msg_args=() # Arguments to show in the commit msg
|
92
|
+
local subrepos=() # List of multiple subrepos
|
93
|
+
|
94
|
+
local all_wanted=false # Apply command to all subrepos
|
95
|
+
local ALL_wanted=false # Apply command to all subrepos and subsubrepos
|
96
|
+
local force_wanted=false # Force certain operations
|
97
|
+
local fetch_wanted=false # Fetch requested before a command
|
98
|
+
local squash_wanted=false # Squash commits on push
|
99
|
+
local update_wanted=false # Update .gitrepo with --branch and/or --remote
|
100
|
+
|
101
|
+
local quiet_wanted=false # Output should be quiet
|
102
|
+
local verbose_wanted=false # Output should be verbose
|
103
|
+
local debug_wanted=false # Show debug messages
|
104
|
+
|
105
|
+
local subdir= # Subdirectory of the subrepo being used
|
106
|
+
local subref= # Valid git ref format of subdir
|
107
|
+
local gitrepo= # Path to .gitrepo file
|
108
|
+
local worktree= # Worktree created by 'git worktree'
|
109
|
+
local start_pwd=$(pwd) # Store the original directory
|
110
|
+
|
111
|
+
local original_head_commit= # HEAD commit id at start of command
|
112
|
+
local original_head_branch= # HEAD ref at start of command
|
113
|
+
local upstream_head_commit= # HEAD commit id from a subrepo fetch
|
114
|
+
|
115
|
+
local subrepo_remote= # Remote url for subrepo's upstream repo
|
116
|
+
local subrepo_branch= # Upstream branch to clone/push/pull
|
117
|
+
local subrepo_commit= # Upstream HEAD from previous clone/pull
|
118
|
+
local subrepo_parent= # Local commit from before previous clone/pull
|
119
|
+
local subrepo_former= # A retired gitrepo key that might still exist
|
120
|
+
|
121
|
+
local refs_subrepo_branch= # A subrepo ref -> commit of branch/pull command
|
122
|
+
local refs_subrepo_commit= # A subrepo ref -> commit last merged
|
123
|
+
local refs_subrepo_fetch= # A subrepo ref -> FETCH_HEAD after fetch
|
124
|
+
local refs_subrepo_push= # A subrepo ref -> branch after push
|
125
|
+
|
126
|
+
local override_remote= # Remote specified with -r
|
127
|
+
local override_branch= # Remote specified with -b
|
128
|
+
|
129
|
+
local edit_wanted=false # Edit commit message using -e
|
130
|
+
local wanted_commit_message= # Custom commit message using -m
|
131
|
+
|
132
|
+
local join_method= # Current join method (rebase/merge)
|
133
|
+
|
134
|
+
local FAIL=true # Flag for RUN: fail on error
|
135
|
+
local OUT=false # Flag for RUN: put output in $output
|
136
|
+
local TTY=false # Flag for RUN: print output directly
|
137
|
+
local SAY=true # Flag for RUN: print command for verbose
|
138
|
+
local EXEC=false # Flag for RUN: run subprocess
|
139
|
+
local OK=true # Flag that commands have succeeded
|
140
|
+
local CODE=0 # Failure reason code
|
141
|
+
local INDENT= # Verbose indentation
|
142
|
+
|
143
|
+
local git_version= # Git version in use
|
144
|
+
|
145
|
+
# Check environment and parse CLI options:
|
146
|
+
assert-environment-ok
|
147
|
+
|
148
|
+
# Parse and validate command options:
|
149
|
+
get-command-options "$@"
|
150
|
+
|
151
|
+
# Make sure repo is in the proper state:
|
152
|
+
assert-repo-is-ready
|
153
|
+
|
154
|
+
command-init
|
155
|
+
|
156
|
+
if $all_wanted && [[ ! $command =~ ^(help|status)$ ]]; then
|
157
|
+
# Run the command on all subrepos
|
158
|
+
local args=( "${command_arguments[@]}" )
|
159
|
+
get-all-subrepos
|
160
|
+
for subdir in ${subrepos[*]}; do
|
161
|
+
command-prepare
|
162
|
+
subrepo_remote=
|
163
|
+
subrepo_branch=
|
164
|
+
command_arguments=( "$subdir" "${args[@]}" )
|
165
|
+
"command:$command"
|
166
|
+
done
|
167
|
+
else
|
168
|
+
# Run the command on a specific subrepo
|
169
|
+
command-prepare
|
170
|
+
"command:$command"
|
171
|
+
fi
|
172
|
+
}
|
173
|
+
|
174
|
+
#------------------------------------------------------------------------------
|
175
|
+
# API command functions.
|
176
|
+
#
|
177
|
+
# Most of these commands call a subrepo:$command function to do the actual
|
178
|
+
# work. The user facing output (via `say`) is done up here. The
|
179
|
+
# subrepo:* worker functions are meant to be called internally and don't print
|
180
|
+
# info to the user.
|
181
|
+
#------------------------------------------------------------------------------
|
182
|
+
|
183
|
+
# `git subrepo clone <url> [<subdir>]` command:
|
184
|
+
command:clone() {
|
185
|
+
command-setup +subrepo_remote subdir:guess-subdir
|
186
|
+
|
187
|
+
# Clone (or reclone) the subrepo into the subdir:
|
188
|
+
local reclone_up_to_date=false
|
189
|
+
subrepo:clone
|
190
|
+
if "$reclone_up_to_date"; then
|
191
|
+
say "Subrepo '$subdir' is up to date."
|
192
|
+
return
|
193
|
+
fi
|
194
|
+
|
195
|
+
# Successful command output:
|
196
|
+
local re=
|
197
|
+
$force_wanted && re=re
|
198
|
+
local remote="$subrepo_remote"
|
199
|
+
say "Subrepo '$remote' ($subrepo_branch) ${re}cloned into '$subdir'."
|
200
|
+
}
|
201
|
+
|
202
|
+
# `git subrepo init <subdir>` command:
|
203
|
+
command:init() {
|
204
|
+
command-setup +subdir
|
205
|
+
local remote="${subrepo_remote:=none}"
|
206
|
+
local branch="${subrepo_branch:=master}"
|
207
|
+
|
208
|
+
# Init new subrepo from the subdir:
|
209
|
+
subrepo:init
|
210
|
+
if OK; then
|
211
|
+
if [[ $remote == none ]]; then
|
212
|
+
say "Subrepo created from '$subdir' (with no remote)."
|
213
|
+
else
|
214
|
+
say "Subrepo created from '$subdir' with remote '$remote' ($branch)."
|
215
|
+
fi
|
216
|
+
else
|
217
|
+
die "Unknown init error code: '$CODE'"
|
218
|
+
fi
|
219
|
+
return 0
|
220
|
+
}
|
221
|
+
|
222
|
+
# `git subrepo pull <subdir>` command:
|
223
|
+
command:pull() {
|
224
|
+
command-setup +subdir
|
225
|
+
|
226
|
+
subrepo:pull
|
227
|
+
if OK; then
|
228
|
+
say "Subrepo '$subdir' pulled from '$subrepo_remote' ($subrepo_branch)."
|
229
|
+
elif [[ $CODE -eq -1 ]]; then
|
230
|
+
say "Subrepo '$subdir' is up to date."
|
231
|
+
elif [[ $CODE -eq 1 ]]; then
|
232
|
+
error-join
|
233
|
+
return "$CODE"
|
234
|
+
else
|
235
|
+
die "Unknown pull error code: '$CODE'"
|
236
|
+
fi
|
237
|
+
return 0
|
238
|
+
}
|
239
|
+
|
240
|
+
# `git subrepo push <subdir>` command:
|
241
|
+
command:push() {
|
242
|
+
local branch=
|
243
|
+
command-setup +subdir branch
|
244
|
+
|
245
|
+
subrepo:push
|
246
|
+
if OK; then
|
247
|
+
say "Subrepo '$subdir' pushed to '$subrepo_remote' ($subrepo_branch)."
|
248
|
+
elif [[ $CODE -eq -2 ]]; then
|
249
|
+
say "Subrepo '$subdir' has no new commits to push."
|
250
|
+
elif [[ $CODE -eq 1 ]]; then
|
251
|
+
error-join
|
252
|
+
return "$CODE"
|
253
|
+
else
|
254
|
+
die "Unknown push error code: '$CODE'"
|
255
|
+
fi
|
256
|
+
return 0
|
257
|
+
}
|
258
|
+
|
259
|
+
# `git subrepo fetch <subdir>` command
|
260
|
+
command:fetch() {
|
261
|
+
command-setup +subdir
|
262
|
+
if [[ $subrepo_remote == "none" ]]; then
|
263
|
+
say "Ignored '$subdir', no remote."
|
264
|
+
else
|
265
|
+
subrepo:fetch
|
266
|
+
say "Fetched '$subdir' from '$subrepo_remote' ($subrepo_branch)."
|
267
|
+
fi
|
268
|
+
}
|
269
|
+
|
270
|
+
# `git subrepo branch <subdir>` command:
|
271
|
+
command:branch() {
|
272
|
+
command-setup +subdir
|
273
|
+
if $fetch_wanted; then
|
274
|
+
CALL subrepo:fetch
|
275
|
+
fi
|
276
|
+
|
277
|
+
local branch="subrepo/$subref"
|
278
|
+
if $force_wanted; then
|
279
|
+
# We must make sure that the worktree is removed as well
|
280
|
+
worktree="$GIT_TMP/$branch"
|
281
|
+
git:delete-branch "$branch"
|
282
|
+
fi
|
283
|
+
|
284
|
+
if git:branch-exists "$branch"; then
|
285
|
+
error "Branch '$branch' already exists. Use '--force' to override."
|
286
|
+
fi
|
287
|
+
|
288
|
+
# Create the subrepo branch:
|
289
|
+
subrepo:branch
|
290
|
+
|
291
|
+
say "Created branch '$branch' and worktree '$worktree'."
|
292
|
+
}
|
293
|
+
|
294
|
+
# `git subrepo commit <subdir>` command
|
295
|
+
command:commit() {
|
296
|
+
command-setup +subdir subrepo_commit_ref
|
297
|
+
|
298
|
+
if "$fetch_wanted"; then
|
299
|
+
CALL subrepo:fetch
|
300
|
+
fi
|
301
|
+
git:rev-exists "$refs_subrepo_fetch" ||
|
302
|
+
error "Can't find ref '$refs_subrepo_fetch'. Try using -F."
|
303
|
+
upstream_head_commit="$(git rev-parse "$refs_subrepo_fetch")"
|
304
|
+
|
305
|
+
[[ -n $subrepo_commit_ref ]] ||
|
306
|
+
subrepo_commit_ref="subrepo/$subref"
|
307
|
+
subrepo:commit
|
308
|
+
|
309
|
+
say "Subrepo commit '$subrepo_commit_ref' committed as"
|
310
|
+
say "subdir '$subdir/' to branch '$original_head_branch'."
|
311
|
+
}
|
312
|
+
|
313
|
+
# `git subrepo status [<subdir>]` command:
|
314
|
+
command:status() {
|
315
|
+
subrepo:status | ${GIT_SUBREPO_PAGER}
|
316
|
+
}
|
317
|
+
|
318
|
+
status-refs() {
|
319
|
+
local output=
|
320
|
+
while read line; do
|
321
|
+
[[ $line =~ ^([0-9a-f]+)\ refs/subrepo/$subref/([a-z]+) ]] || continue
|
322
|
+
local sha1=; sha1="$(git rev-parse --short "${BASH_REMATCH[1]}")"
|
323
|
+
local type="${BASH_REMATCH[2]}"
|
324
|
+
local ref="refs/subrepo/$subref/$type"
|
325
|
+
if [[ $type == branch ]]; then
|
326
|
+
output+=" Branch Ref: $sha1 ($ref)"$'\n'
|
327
|
+
elif [[ $type == commit ]]; then
|
328
|
+
output+=" Commit Ref: $sha1 ($ref)"$'\n'
|
329
|
+
elif [[ $type == fetch ]]; then
|
330
|
+
output+=" Fetch Ref: $sha1 ($ref)"$'\n'
|
331
|
+
elif [[ $type == pull ]]; then
|
332
|
+
output+=" Pull Ref: $sha1 ($ref)"$'\n'
|
333
|
+
elif [[ $type == push ]]; then
|
334
|
+
output+=" Push Ref: $sha1 ($ref)"$'\n'
|
335
|
+
fi
|
336
|
+
done < <(git show-ref)
|
337
|
+
if [[ -n $output ]]; then
|
338
|
+
printf " Refs:\n$output"
|
339
|
+
fi
|
340
|
+
}
|
341
|
+
|
342
|
+
# `git subrepo clean <subdir>` command
|
343
|
+
command:clean() {
|
344
|
+
command-setup +subdir
|
345
|
+
local clean_list=()
|
346
|
+
subrepo:clean
|
347
|
+
for item in "${clean_list[@]}"; do
|
348
|
+
say "Removed $item."
|
349
|
+
done
|
350
|
+
}
|
351
|
+
|
352
|
+
# Wrap git config $gitrepo
|
353
|
+
command:config() {
|
354
|
+
command-setup +subdir +config_option config_value
|
355
|
+
o "Update '$subdir' configuration with $config_option=$config_value"
|
356
|
+
|
357
|
+
if [[ ! $config_option =~ ^(branch|cmdver|commit|method|remote|version)$ ]]; then
|
358
|
+
error "Option $config_option not recognized"
|
359
|
+
fi
|
360
|
+
|
361
|
+
if [[ -z $config_value ]]; then
|
362
|
+
OUT=true RUN git config --file="$gitrepo" "subrepo.$config_option"
|
363
|
+
say "Subrepo '$subdir' option '$config_option' has value '$output'."
|
364
|
+
return
|
365
|
+
fi
|
366
|
+
|
367
|
+
if ! $force_wanted; then
|
368
|
+
# Only allow changing method without force
|
369
|
+
if [[ ! $config_option == "method" ]]; then
|
370
|
+
error "This option is autogenerated, use '--force' to override."
|
371
|
+
fi
|
372
|
+
fi
|
373
|
+
|
374
|
+
if [[ $config_option == "method" ]]; then
|
375
|
+
if [[ ! $config_value =~ ^(merge|rebase)$ ]]; then
|
376
|
+
error "Not a valid method. Valid options are 'merge' or 'rebase'."
|
377
|
+
fi
|
378
|
+
fi
|
379
|
+
|
380
|
+
RUN git config --file="$gitrepo" "subrepo.$config_option" "$config_value"
|
381
|
+
say "Subrepo '$subdir' option '$config_option' set to '$config_value'."
|
382
|
+
}
|
383
|
+
|
384
|
+
|
385
|
+
# Launch the manpage viewer:
|
386
|
+
command:help() {
|
387
|
+
source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash"
|
388
|
+
local cmd="${command_arguments[0]}"
|
389
|
+
if [[ -n $cmd ]]; then
|
390
|
+
if can "help:$cmd"; then
|
391
|
+
"help:$cmd"
|
392
|
+
echo
|
393
|
+
else
|
394
|
+
err "No help found for '$cmd'"
|
395
|
+
fi
|
396
|
+
elif $all_wanted; then
|
397
|
+
help:all
|
398
|
+
else
|
399
|
+
exec git help subrepo
|
400
|
+
fi
|
401
|
+
msg_ok=0
|
402
|
+
}
|
403
|
+
|
404
|
+
# Print version info.
|
405
|
+
# TODO: Add short commit id after version.
|
406
|
+
# Will need to get it from repo or make install can put it somewhere.
|
407
|
+
command:version() {
|
408
|
+
cat <<...
|
409
|
+
git-subrepo Version: $VERSION
|
410
|
+
Copyright 2013-2020 Ingy döt Net
|
411
|
+
https://github.com/ingydotnet/git-subrepo
|
412
|
+
$BASH_SOURCE
|
413
|
+
Git Version: $git_version
|
414
|
+
|
415
|
+
...
|
416
|
+
:
|
417
|
+
}
|
418
|
+
|
419
|
+
command:upgrade() {
|
420
|
+
local path="$0"
|
421
|
+
if [[ $path =~ ^/ && $path =~ ^(.*/git-subrepo)/lib/git-subrepo$ ]]; then
|
422
|
+
local subrepo_root="${BASH_REMATCH[1]}"
|
423
|
+
(
|
424
|
+
o "Change directory to '$subrepo_root'."
|
425
|
+
cd "${BASH_REMATCH[1]}"
|
426
|
+
|
427
|
+
local branch="$(git rev-parse --abbrev-ref HEAD)"
|
428
|
+
if [[ $branch != master ]]; then
|
429
|
+
error "git-subrepo repo is not on the 'master' branch"
|
430
|
+
fi
|
431
|
+
|
432
|
+
o "'git pull' latest version."
|
433
|
+
RUN git pull --ff-only
|
434
|
+
|
435
|
+
say "git-subrepo is up to date."
|
436
|
+
)
|
437
|
+
else
|
438
|
+
die "\
|
439
|
+
|
440
|
+
Sorry. Your installation can't use the 'git subrepo upgrade' command. The
|
441
|
+
command only works if you installed git subrepo by adding
|
442
|
+
'/path/to/git-subrepo' to your PATH.
|
443
|
+
|
444
|
+
If you used 'make install' to install git-subrepo, then just do this:
|
445
|
+
|
446
|
+
cd /path/to/git-subrepo
|
447
|
+
git pull
|
448
|
+
make install
|
449
|
+
|
450
|
+
"
|
451
|
+
fi
|
452
|
+
}
|
453
|
+
|
454
|
+
#------------------------------------------------------------------------------
|
455
|
+
# Subrepo command worker functions.
|
456
|
+
#------------------------------------------------------------------------------
|
457
|
+
|
458
|
+
# Clone by fetching remote content into our subdir:
|
459
|
+
subrepo:clone() {
|
460
|
+
re="$1"
|
461
|
+
|
462
|
+
FAIL=false RUN git rev-parse HEAD
|
463
|
+
if ! OK; then
|
464
|
+
error "You can't clone into an empty repository"
|
465
|
+
fi
|
466
|
+
|
467
|
+
# Turn off force unless really a reclone:
|
468
|
+
if $force_wanted && [[ ! -f $gitrepo ]]; then
|
469
|
+
force_wanted=false
|
470
|
+
fi
|
471
|
+
|
472
|
+
if $force_wanted; then
|
473
|
+
o "--force indicates a reclone."
|
474
|
+
CALL subrepo:fetch
|
475
|
+
read-gitrepo-file
|
476
|
+
o "Check if we already are up to date."
|
477
|
+
if [[ $upstream_head_commit == $subrepo_commit ]]; then
|
478
|
+
reclone_up_to_date=true
|
479
|
+
return
|
480
|
+
fi
|
481
|
+
o "Remove the old subdir."
|
482
|
+
RUN git rm -r -- "$subdir"
|
483
|
+
else
|
484
|
+
assert-subdir-empty
|
485
|
+
if [[ -z $subrepo_branch ]]; then
|
486
|
+
o "Determine the upstream head branch."
|
487
|
+
get-upstream-head-branch
|
488
|
+
subrepo_branch="$output"
|
489
|
+
fi
|
490
|
+
|
491
|
+
CALL subrepo:fetch
|
492
|
+
fi
|
493
|
+
|
494
|
+
o "Make the directory '$subdir/' for the clone."
|
495
|
+
RUN mkdir -p -- "$subdir"
|
496
|
+
|
497
|
+
o "Commit the new '$subdir/' content."
|
498
|
+
subrepo_commit_ref="$upstream_head_commit"
|
499
|
+
CALL subrepo:commit
|
500
|
+
}
|
501
|
+
|
502
|
+
# Init a new subrepo from current repo:
|
503
|
+
subrepo:init() {
|
504
|
+
local branch_name="subrepo/${subref:??}"
|
505
|
+
# Check if subdir is proper candidate for this init:
|
506
|
+
assert-subdir-ready-for-init
|
507
|
+
|
508
|
+
o "Put info into '$subdir/.gitrepo' file."
|
509
|
+
update-gitrepo-file
|
510
|
+
|
511
|
+
o "Add the new '$subdir/.gitrepo' file."
|
512
|
+
# -f from pull request #219. TODO needs test.
|
513
|
+
RUN git add -f -- "$gitrepo"
|
514
|
+
|
515
|
+
o "Commit new subrepo to the '$original_head_branch' branch."
|
516
|
+
subrepo_commit_ref="$original_head_commit"
|
517
|
+
RUN git commit -m "$(get-commit-message)"
|
518
|
+
|
519
|
+
o "Create ref '$refs_subrepo_commit'."
|
520
|
+
git:make-ref "$refs_subrepo_commit" "$subrepo_commit_ref"
|
521
|
+
}
|
522
|
+
|
523
|
+
# Properly merge a local subrepo branch with upstream and commit to mainline:
|
524
|
+
subrepo:pull() {
|
525
|
+
CALL subrepo:fetch
|
526
|
+
|
527
|
+
# Check if we already are up to date
|
528
|
+
# If the -u flag is present, always perform the operation
|
529
|
+
if [[ $upstream_head_commit == $subrepo_commit ]] && ! $update_wanted; then
|
530
|
+
OK=false; CODE=-1; return
|
531
|
+
fi
|
532
|
+
|
533
|
+
local branch_name="subrepo/$subref"
|
534
|
+
git:delete-branch "$branch_name"
|
535
|
+
|
536
|
+
subrepo_commit_ref="$branch_name"
|
537
|
+
|
538
|
+
o "Create subrepo branch '$branch_name'."
|
539
|
+
CALL subrepo:branch
|
540
|
+
cd "$worktree";
|
541
|
+
|
542
|
+
if [[ "$join_method" == "rebase" ]]; then
|
543
|
+
o "Rebase changes to $refs_subrepo_fetch"
|
544
|
+
FAIL=false OUT=true RUN git rebase "$refs_subrepo_fetch" "$branch_name"
|
545
|
+
if ! OK; then
|
546
|
+
say "The \"git rebase\" command failed:"
|
547
|
+
say
|
548
|
+
say " ${output//$'\n'/$'\n' }"
|
549
|
+
CODE=1
|
550
|
+
return
|
551
|
+
fi
|
552
|
+
else
|
553
|
+
o "Merge in changes from $refs_subrepo_fetch"
|
554
|
+
FAIL=false RUN git merge "$refs_subrepo_fetch"
|
555
|
+
if ! OK; then
|
556
|
+
say "The \"git merge\" command failed:"
|
557
|
+
say
|
558
|
+
say " ${output//$'\n'/$'\n' }"
|
559
|
+
CODE=1
|
560
|
+
return
|
561
|
+
fi
|
562
|
+
fi
|
563
|
+
|
564
|
+
o "Back to $start_pwd"
|
565
|
+
cd "$start_pwd";
|
566
|
+
|
567
|
+
o "Create ref '$refs_subrepo_branch' for branch '$branch_name'."
|
568
|
+
git:make-ref "$refs_subrepo_branch" "$branch_name"
|
569
|
+
|
570
|
+
o "Commit the new '$subrepo_commit_ref' content."
|
571
|
+
CALL subrepo:commit
|
572
|
+
}
|
573
|
+
|
574
|
+
# Push a properly merged subrepo branch upstream:
|
575
|
+
subrepo:push() {
|
576
|
+
local branch_name="$branch"
|
577
|
+
local new_upstream=false
|
578
|
+
local branch_created=false
|
579
|
+
|
580
|
+
if [[ -z $branch_name ]]; then
|
581
|
+
FAIL=false OUT=false CALL subrepo:fetch
|
582
|
+
|
583
|
+
if ! OK; then
|
584
|
+
# Check if we are pushing to a new upstream repo (or branch) and just
|
585
|
+
# push the commit directly. This is common after a `git subrepo init`:
|
586
|
+
# Force to case in
|
587
|
+
local re="(^|"$'\n'")fatal: couldn't find remote ref "
|
588
|
+
if [[ ${output,,} =~ $re ]]; then
|
589
|
+
o "Pushing to new upstream: $subrepo_remote ($subrepo_branch)."
|
590
|
+
new_upstream=true
|
591
|
+
else
|
592
|
+
error "Fetch for push failed: $output"
|
593
|
+
fi
|
594
|
+
else
|
595
|
+
# Check that we are up to date:
|
596
|
+
o "Check upstream head against .gitrepo commit."
|
597
|
+
if ! $force_wanted; then
|
598
|
+
if [[ $upstream_head_commit != $subrepo_commit ]]; then
|
599
|
+
error "There are new changes upstream, you need to pull first."
|
600
|
+
fi
|
601
|
+
fi
|
602
|
+
fi
|
603
|
+
|
604
|
+
branch_name="subrepo/$subref"
|
605
|
+
git:delete-branch "$branch_name"
|
606
|
+
|
607
|
+
if $squash_wanted; then
|
608
|
+
o "Squash commits"
|
609
|
+
subrepo_parent="HEAD^"
|
610
|
+
fi
|
611
|
+
|
612
|
+
o "Create subrepo branch '$branch_name'."
|
613
|
+
CALL subrepo:branch "$branch_name"
|
614
|
+
cd "$worktree";
|
615
|
+
|
616
|
+
if [[ "$join_method" == "rebase" ]]; then
|
617
|
+
o "Rebase changes to $refs_subrepo_fetch"
|
618
|
+
FAIL=false OUT=true RUN git rebase "$refs_subrepo_fetch" "$branch_name"
|
619
|
+
if ! OK; then
|
620
|
+
say "The \"git rebase\" command failed:"
|
621
|
+
say
|
622
|
+
say " ${output//$'\n'/$'\n' }"
|
623
|
+
CODE=1
|
624
|
+
return
|
625
|
+
fi
|
626
|
+
fi
|
627
|
+
branch_created=true
|
628
|
+
cd "$start_pwd"
|
629
|
+
else
|
630
|
+
if $squash_wanted; then
|
631
|
+
error "Squash option (-s) can't be used with branch parameter"
|
632
|
+
fi
|
633
|
+
fi
|
634
|
+
|
635
|
+
o "Make sure that '$branch_name' exists."
|
636
|
+
git:branch-exists "$branch_name" ||
|
637
|
+
error "No subrepo branch '$branch_name' to push."
|
638
|
+
|
639
|
+
o "Check if we have something to push"
|
640
|
+
new_upstream_head_commit="$(git rev-parse "$branch_name")"
|
641
|
+
if ! $new_upstream; then
|
642
|
+
if [[ $upstream_head_commit == $new_upstream_head_commit ]]; then
|
643
|
+
OK=false
|
644
|
+
CODE=-2
|
645
|
+
return
|
646
|
+
fi
|
647
|
+
fi
|
648
|
+
|
649
|
+
if ! $force_wanted; then
|
650
|
+
o "Make sure '$branch_name' contains the '$refs_subrepo_fetch' HEAD."
|
651
|
+
if ! git:commit-in-rev-list "$upstream_head_commit" "$branch_name"; then
|
652
|
+
error "Can't commit: '$branch_name' doesn't contain upstream HEAD: " \
|
653
|
+
"$upstream_head_commit"
|
654
|
+
fi
|
655
|
+
fi
|
656
|
+
|
657
|
+
local force=''
|
658
|
+
"$force_wanted" && force=' --force'
|
659
|
+
|
660
|
+
o "Push$force branch '$branch_name' to '$subrepo_remote' ($subrepo_branch)."
|
661
|
+
RUN git push$force "$subrepo_remote" "$branch_name":"$subrepo_branch"
|
662
|
+
|
663
|
+
o "Create ref '$refs_subrepo_push' for branch '$branch_name'."
|
664
|
+
git:make-ref "$refs_subrepo_push" "$branch_name"
|
665
|
+
|
666
|
+
if $branch_created; then
|
667
|
+
o "Remove branch '$branch_name'."
|
668
|
+
git:delete-branch "$branch_name"
|
669
|
+
fi
|
670
|
+
|
671
|
+
o "Put updates into '$subdir/.gitrepo' file."
|
672
|
+
upstream_head_commit="$new_upstream_head_commit"
|
673
|
+
subrepo_commit_ref="$upstream_head_commit"
|
674
|
+
update-gitrepo-file
|
675
|
+
RUN git commit -m "$(get-commit-message)"
|
676
|
+
}
|
677
|
+
|
678
|
+
# Fetch the subrepo's remote branch content:
|
679
|
+
subrepo:fetch() {
|
680
|
+
if [[ $subrepo_remote == none ]]; then
|
681
|
+
error "Can't fetch subrepo. Remote is 'none' in '$subdir/.gitrepo'."
|
682
|
+
fi
|
683
|
+
|
684
|
+
o "Fetch the upstream: $subrepo_remote ($subrepo_branch)."
|
685
|
+
RUN git fetch --no-tags --quiet "$subrepo_remote" "$subrepo_branch"
|
686
|
+
OK || return
|
687
|
+
|
688
|
+
o "Get the upstream subrepo HEAD commit."
|
689
|
+
OUT=true RUN git rev-parse FETCH_HEAD^0
|
690
|
+
upstream_head_commit="$output"
|
691
|
+
|
692
|
+
o "Create ref '$refs_subrepo_fetch'."
|
693
|
+
git:make-ref "$refs_subrepo_fetch" FETCH_HEAD^0
|
694
|
+
}
|
695
|
+
|
696
|
+
# Create a subrepo branch containing all changes
|
697
|
+
subrepo:branch() {
|
698
|
+
local branch="${1:-"subrepo/$subref"}"
|
699
|
+
o "Check if the '$branch' branch already exists."
|
700
|
+
git:branch-exists "$branch" && return
|
701
|
+
|
702
|
+
local last_gitrepo_commit=
|
703
|
+
local first_gitrepo_commit=
|
704
|
+
|
705
|
+
o "Subrepo parent: $subrepo_parent"
|
706
|
+
if [[ -n "$subrepo_parent" ]]; then
|
707
|
+
local prev_commit=
|
708
|
+
local ancestor=
|
709
|
+
o "Create new commits with parents into the subrepo fetch"
|
710
|
+
OUT=true RUN git rev-list --reverse --ancestry-path --topo-order "$subrepo_parent..HEAD"
|
711
|
+
local commit_list="$output"
|
712
|
+
for commit in $commit_list; do
|
713
|
+
o "Working on $commit"
|
714
|
+
|
715
|
+
FAIL=false OUT=true RUN git config --blob \
|
716
|
+
"$commit":"$subdir/.gitrepo" "subrepo.commit"
|
717
|
+
if [[ -z "$output" ]]; then
|
718
|
+
o "Ignore commit, no .gitrepo file"
|
719
|
+
continue
|
720
|
+
fi
|
721
|
+
|
722
|
+
local gitrepo_commit="$output"
|
723
|
+
o ".gitrepo reference commit: $gitrepo_commit"
|
724
|
+
|
725
|
+
|
726
|
+
# Only include the commit if it's a child of the previous commit
|
727
|
+
# This way we create a single path between $subrepo_parent..HEAD
|
728
|
+
if [[ -n "$ancestor" ]]; then
|
729
|
+
local is_direct_child=$(git show -s --pretty=format:"%P" $commit | grep "$ancestor")
|
730
|
+
o "is child: $is_direct_child"
|
731
|
+
if [[ -z "$is_direct_child" ]]; then
|
732
|
+
o "Ignore $commit, it's not in the selected path"
|
733
|
+
continue
|
734
|
+
fi
|
735
|
+
fi
|
736
|
+
|
737
|
+
# Remember the previous commit from the parent repo path
|
738
|
+
ancestor="$commit"
|
739
|
+
|
740
|
+
o "Check for rebase"
|
741
|
+
if git:rev-exists "$refs_subrepo_fetch"; then
|
742
|
+
if ! git:commit-in-rev-list "$gitrepo_commit" "$refs_subrepo_fetch"; then
|
743
|
+
error "Local repository does not contain $gitrepo_commit. Try to 'git subrepo fetch $subref' or add the '-F' flag to always fetch the latest content."
|
744
|
+
fi
|
745
|
+
fi
|
746
|
+
|
747
|
+
o "Find parents"
|
748
|
+
local first_parent=
|
749
|
+
[[ -n $prev_commit ]] && first_parent="-p $prev_commit"
|
750
|
+
local second_parent=
|
751
|
+
if [[ -z "$first_gitrepo_commit" ]]; then
|
752
|
+
first_gitrepo_commit="$gitrepo_commit"
|
753
|
+
second_parent="-p $gitrepo_commit"
|
754
|
+
fi
|
755
|
+
|
756
|
+
if [[ "$join_method" != "rebase" ]]; then
|
757
|
+
# In the rebase case we don't create merge commits
|
758
|
+
if [[ "$gitrepo_commit" != "$last_gitrepo_commit" ]]; then
|
759
|
+
second_parent="-p $gitrepo_commit"
|
760
|
+
last_gitrepo_commit="$gitrepo_commit"
|
761
|
+
fi
|
762
|
+
fi
|
763
|
+
|
764
|
+
o "Create a new commit $first_parent $second_parent"
|
765
|
+
FAIL=false RUN git cat-file -e "$commit":"$subdir"
|
766
|
+
if OK; then
|
767
|
+
o "Create with content"
|
768
|
+
local PREVIOUS_IFS=$IFS
|
769
|
+
IFS=$'\n'
|
770
|
+
local author_info=( $(git log -1 --date=default --format=%ad%n%ae%n%an "$commit") )
|
771
|
+
local commiter_info=( $(git log -1 --date=default --format=%cd%n%ce%n%cn "$commit") )
|
772
|
+
IFS=$PREVIOUS_IFS
|
773
|
+
|
774
|
+
# When we create new commits we leave the author information unchanged
|
775
|
+
# the committer will though be updated to the current user
|
776
|
+
# This should be analog how cherrypicking is handled allowing git
|
777
|
+
# to store both the original author but also the responsible committer
|
778
|
+
# that created the local version of the commit and pushed it.
|
779
|
+
prev_commit=$(git log -n 1 --date=default --format=%B "$commit" |
|
780
|
+
GIT_AUTHOR_DATE="${author_info[0]}" \
|
781
|
+
GIT_AUTHOR_EMAIL="${author_info[1]}" \
|
782
|
+
GIT_AUTHOR_NAME="${author_info[2]}" \
|
783
|
+
GIT_COMMITTER_DATE="${commiter_info[0]}" \
|
784
|
+
GIT_COMMITTER_EMAIL="${commiter_info[1]}" \
|
785
|
+
GIT_COMMITTER_NAME="${commiter_info[2]}" \
|
786
|
+
git commit-tree -F - $first_parent $second_parent "$commit":"$subdir")
|
787
|
+
else
|
788
|
+
o "Create empty placeholder"
|
789
|
+
prev_commit=$(git commit-tree -m "EMPTY" \
|
790
|
+
$first_parent $second_parent "4b825dc642cb6eb9a060e54bf8d69288fbee4904")
|
791
|
+
fi
|
792
|
+
done
|
793
|
+
|
794
|
+
o "Create branch '$branch' for this new commit set $prev_commit."
|
795
|
+
RUN git branch "$branch" "$prev_commit"
|
796
|
+
else
|
797
|
+
o "No parent setting, use the subdir content."
|
798
|
+
RUN git branch "$branch" HEAD
|
799
|
+
TTY=true FAIL=false RUN git filter-branch -f --subdirectory-filter \
|
800
|
+
"$subref" "$branch"
|
801
|
+
fi
|
802
|
+
|
803
|
+
o "Remove the .gitrepo file from $first_gitrepo_commit..$branch"
|
804
|
+
local filter="$branch"
|
805
|
+
[[ -n "$first_gitrepo_commit" ]] && filter="$first_gitrepo_commit..$branch"
|
806
|
+
FAIL=false RUN git filter-branch -f --prune-empty --tree-filter \
|
807
|
+
"rm -f .gitrepo" "$filter"
|
808
|
+
|
809
|
+
git:create-worktree "$branch"
|
810
|
+
|
811
|
+
o "Create ref '$refs_subrepo_branch'."
|
812
|
+
git:make-ref "$refs_subrepo_branch" "$branch"
|
813
|
+
}
|
814
|
+
|
815
|
+
# Commit a merged subrepo branch:
|
816
|
+
subrepo:commit() {
|
817
|
+
o "Check that '$subrepo_commit_ref' exists."
|
818
|
+
git:rev-exists "$subrepo_commit_ref" ||
|
819
|
+
error "Commit ref '$subrepo_commit_ref' does not exist."
|
820
|
+
|
821
|
+
if ! "$force_wanted"; then
|
822
|
+
local upstream="$upstream_head_commit"
|
823
|
+
o "Make sure '$subrepo_commit_ref' contains the upstream HEAD."
|
824
|
+
if ! git:commit-in-rev-list "$upstream" "$subrepo_commit_ref"; then
|
825
|
+
error \
|
826
|
+
"Can't commit: '$subrepo_commit_ref' doesn't contain upstream HEAD."
|
827
|
+
fi
|
828
|
+
fi
|
829
|
+
|
830
|
+
if git ls-files -- "$subdir" | grep -q .; then
|
831
|
+
o "Remove old content of the subdir."
|
832
|
+
RUN git rm -r -- "$subdir"
|
833
|
+
fi
|
834
|
+
|
835
|
+
o "Put remote subrepo content into '$subdir/'."
|
836
|
+
RUN git read-tree --prefix="$subdir" -u "$subrepo_commit_ref"
|
837
|
+
|
838
|
+
o "Put info into '$subdir/.gitrepo' file."
|
839
|
+
update-gitrepo-file
|
840
|
+
RUN git add -f -- "$gitrepo"
|
841
|
+
|
842
|
+
local commit_message
|
843
|
+
if [[ -n "$wanted_commit_message" ]]; then
|
844
|
+
commit_message="$wanted_commit_message"
|
845
|
+
else
|
846
|
+
commit_message="$(get-commit-message)"
|
847
|
+
fi
|
848
|
+
|
849
|
+
local edit_flag=
|
850
|
+
$edit_wanted && edit_flag=--edit
|
851
|
+
|
852
|
+
[[ -n $commit_message ]] || commit_message="$(get-commit-message)"
|
853
|
+
|
854
|
+
local edit_flag=
|
855
|
+
$edit_wanted && edit_flag=--edit
|
856
|
+
|
857
|
+
o "Commit to the '$original_head_branch' branch."
|
858
|
+
if [[ $original_head_commit != none ]]; then
|
859
|
+
RUN git commit $edit_flag -m "$commit_message"
|
860
|
+
else
|
861
|
+
# We had cloned into an empty repo, side effect of prior git reset --mixed
|
862
|
+
# command is that subrepo's history is now part of the index. Commit
|
863
|
+
# without that history.
|
864
|
+
OUT=true RUN git write-tree
|
865
|
+
OUT=true RUN git commit-tree $edit_flag -m "$commit_message" "$output"
|
866
|
+
RUN git reset --hard "$output"
|
867
|
+
fi
|
868
|
+
|
869
|
+
# Clean up worktree to indicate that we are ready
|
870
|
+
git:remove-worktree
|
871
|
+
|
872
|
+
o "Create ref '$refs_subrepo_commit'."
|
873
|
+
git:make-ref "$refs_subrepo_commit" "$subrepo_commit_ref"
|
874
|
+
}
|
875
|
+
|
876
|
+
subrepo:status() {
|
877
|
+
if [[ ${#command_arguments[@]} -eq 0 ]]; then
|
878
|
+
get-all-subrepos
|
879
|
+
local count=${#subrepos[@]}
|
880
|
+
if ! "$quiet_wanted"; then
|
881
|
+
if [[ $count -eq 0 ]]; then
|
882
|
+
echo "No subrepos."
|
883
|
+
return
|
884
|
+
else
|
885
|
+
local s=; [[ $count -eq 1 ]] || s=s
|
886
|
+
echo "$count subrepo$s:"
|
887
|
+
echo
|
888
|
+
fi
|
889
|
+
fi
|
890
|
+
else
|
891
|
+
subrepos=("${command_arguments[@]}")
|
892
|
+
fi
|
893
|
+
|
894
|
+
for subdir in "${subrepos[@]}"; do
|
895
|
+
check-and-normalize-subdir
|
896
|
+
encode-subdir
|
897
|
+
|
898
|
+
if [[ ! -f $subdir/.gitrepo ]]; then
|
899
|
+
echo "'$subdir' is not a subrepo"
|
900
|
+
echo
|
901
|
+
continue
|
902
|
+
fi
|
903
|
+
|
904
|
+
refs_subrepo_fetch="refs/subrepo/$subref/fetch"
|
905
|
+
upstream_head_commit="$(
|
906
|
+
git rev-parse --short "$refs_subrepo_fetch" 2> /dev/null || true
|
907
|
+
)"
|
908
|
+
subrepo_remote=
|
909
|
+
subrepo_branch=
|
910
|
+
|
911
|
+
read-gitrepo-file
|
912
|
+
if $fetch_wanted; then
|
913
|
+
subrepo:fetch
|
914
|
+
fi
|
915
|
+
|
916
|
+
if $quiet_wanted; then
|
917
|
+
echo "$subdir"
|
918
|
+
continue
|
919
|
+
fi
|
920
|
+
|
921
|
+
echo "Git subrepo '$subdir':"
|
922
|
+
git:branch-exists "subrepo/$subref" &&
|
923
|
+
echo " Subrepo Branch: subrepo/$subref"
|
924
|
+
local remote="subrepo/$subref"
|
925
|
+
FAIL=false OUT=true RUN git config "remote.$remote.url"
|
926
|
+
[[ -n $output ]] &&
|
927
|
+
echo " Remote Name: subrepo/$subref"
|
928
|
+
echo " Remote URL: $subrepo_remote"
|
929
|
+
[[ -n $upstream_head_commit ]] &&
|
930
|
+
echo " Upstream Ref: $upstream_head_commit"
|
931
|
+
echo " Tracking Branch: $subrepo_branch"
|
932
|
+
[[ -z $subrepo_commit ]] ||
|
933
|
+
echo " Pulled Commit: $(git rev-parse --short $subrepo_commit)"
|
934
|
+
if [[ -n $subrepo_parent ]]; then
|
935
|
+
echo " Pull Parent: $(git rev-parse --short $subrepo_parent)"
|
936
|
+
# TODO Remove this eventually:
|
937
|
+
elif [[ -n $subrepo_former ]]; then
|
938
|
+
printf " Former Commit: $(git rev-parse --short $subrepo_former)"
|
939
|
+
echo " *** DEPRECATED ***"
|
940
|
+
fi
|
941
|
+
|
942
|
+
# Grep for directory, branch can be in detached state due to conflicts
|
943
|
+
local _worktree=$(git worktree list | grep "$GIT_TMP/subrepo/$subdir")
|
944
|
+
if [[ -n $_worktree ]]; then
|
945
|
+
echo " Worktree: $_worktree"
|
946
|
+
fi
|
947
|
+
|
948
|
+
if "$verbose_wanted"; then
|
949
|
+
status-refs
|
950
|
+
fi
|
951
|
+
|
952
|
+
echo
|
953
|
+
done
|
954
|
+
}
|
955
|
+
|
956
|
+
subrepo:clean() {
|
957
|
+
# Remove subrepo branches if exist:
|
958
|
+
local branch="subrepo/$subref"
|
959
|
+
local ref="refs/heads/$branch"
|
960
|
+
local worktree="$GIT_TMP/$branch"
|
961
|
+
|
962
|
+
o "Clean $subdir"
|
963
|
+
git:remove-worktree
|
964
|
+
if git:branch-exists "$branch"; then
|
965
|
+
o "Remove branch '$branch'."
|
966
|
+
RUN git update-ref -d "$ref"
|
967
|
+
clean_list+=("branch '$branch'")
|
968
|
+
fi
|
969
|
+
|
970
|
+
if "$force_wanted"; then
|
971
|
+
o "Remove all subrepo refs."
|
972
|
+
local suffix=""
|
973
|
+
if ! $all_wanted; then
|
974
|
+
suffix="$subref/"
|
975
|
+
fi
|
976
|
+
git show-ref | while read hash ref; do
|
977
|
+
if [[ "$ref" == refs/subrepo/$suffix* ]]; then
|
978
|
+
git update-ref -d "$ref"
|
979
|
+
fi
|
980
|
+
done
|
981
|
+
fi
|
982
|
+
}
|
983
|
+
|
984
|
+
#------------------------------------------------------------------------------
|
985
|
+
# Support functions:
|
986
|
+
#------------------------------------------------------------------------------
|
987
|
+
|
988
|
+
|
989
|
+
# TODO:
|
990
|
+
# Collect original options and arguments into an array for commit message
|
991
|
+
# They should be normalized and pruned
|
992
|
+
|
993
|
+
# Parse command line options:
|
994
|
+
get-command-options() {
|
995
|
+
[[ $# -eq 0 ]] && set -- --help
|
996
|
+
|
997
|
+
[[ -n $GIT_SUBREPO_QUIET ]] && quiet_wanted=true
|
998
|
+
[[ -n $GIT_SUBREPO_VERBOSE ]] && verbose_wanted=true
|
999
|
+
[[ -n $GIT_SUBREPO_DEBUG ]] && debug_wanted=true
|
1000
|
+
|
1001
|
+
eval "$(
|
1002
|
+
echo "$GETOPT_SPEC" |
|
1003
|
+
git rev-parse --parseopt -- "$@" ||
|
1004
|
+
echo exit $?
|
1005
|
+
)"
|
1006
|
+
|
1007
|
+
while [[ $# -gt 0 ]]; do
|
1008
|
+
local option="$1"; shift
|
1009
|
+
case "$option" in
|
1010
|
+
--) break ;;
|
1011
|
+
-a) all_wanted=true ;;
|
1012
|
+
-A) ALL_wanted=true
|
1013
|
+
all_wanted=true ;;
|
1014
|
+
-b) subrepo_branch="$1"
|
1015
|
+
override_branch="$1"
|
1016
|
+
commit_msg_args+=("--branch=$1")
|
1017
|
+
shift ;;
|
1018
|
+
-e) edit_wanted=true ;;
|
1019
|
+
-f) force_wanted=true
|
1020
|
+
commit_msg_args+=("--force") ;;
|
1021
|
+
-F) fetch_wanted=true ;;
|
1022
|
+
-m) wanted_commit_message="$1"
|
1023
|
+
shift;;
|
1024
|
+
-M) join_method="$1"
|
1025
|
+
shift;;
|
1026
|
+
-M) join_method="$1"
|
1027
|
+
shift;;
|
1028
|
+
-r) subrepo_remote="$1"
|
1029
|
+
override_remote="$1"
|
1030
|
+
commit_msg_args+=("--remote=$1")
|
1031
|
+
shift ;;
|
1032
|
+
-s) squash_wanted=true ;;
|
1033
|
+
-u) update_wanted=true
|
1034
|
+
commit_msg_args+=("--update") ;;
|
1035
|
+
-q) quiet_wanted=true ;;
|
1036
|
+
-v) verbose_wanted=true ;;
|
1037
|
+
-d) debug_wanted=true ;;
|
1038
|
+
-x) set -x ;;
|
1039
|
+
--version)
|
1040
|
+
echo "$VERSION"
|
1041
|
+
exit ;;
|
1042
|
+
*) usage-error "Unexpected option: '$option'." ;;
|
1043
|
+
esac
|
1044
|
+
done
|
1045
|
+
|
1046
|
+
# Set subrepo command:
|
1047
|
+
command="$1"; shift
|
1048
|
+
|
1049
|
+
# Make sure command exists:
|
1050
|
+
can "command:$command" ||
|
1051
|
+
usage-error "'$command' is not a command. See 'git subrepo help'."
|
1052
|
+
|
1053
|
+
command_arguments=("$@")
|
1054
|
+
if [[ ${#command_arguments} -gt 0 ]]; then
|
1055
|
+
local first="${command_arguments[0]}"
|
1056
|
+
first="${first%/}"
|
1057
|
+
command_arguments[0]="$first"
|
1058
|
+
fi
|
1059
|
+
commit_msg_args+=("${command_arguments[@]}")
|
1060
|
+
|
1061
|
+
for option in all ALL edit fetch force squash; do
|
1062
|
+
var="${option}_wanted"
|
1063
|
+
if ${!var}; then
|
1064
|
+
check_option $option
|
1065
|
+
fi
|
1066
|
+
done
|
1067
|
+
|
1068
|
+
if [[ -n $override_branch ]]; then
|
1069
|
+
check_option branch
|
1070
|
+
fi
|
1071
|
+
if [[ -n $override_remote ]]; then
|
1072
|
+
check_option remote
|
1073
|
+
fi
|
1074
|
+
if [[ -n $wanted_commit_message ]]; then
|
1075
|
+
check_option message
|
1076
|
+
fi
|
1077
|
+
if $update_wanted; then
|
1078
|
+
check_option update
|
1079
|
+
if [[ -z $subrepo_branch && -z $subrepo_remote ]]; then
|
1080
|
+
usage-error "Can't use '--update' without '--branch' or '--remote'."
|
1081
|
+
fi
|
1082
|
+
fi
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
options_help='all'
|
1086
|
+
options_branch='all fetch force'
|
1087
|
+
options_clean='ALL all force'
|
1088
|
+
options_clone='branch edit force message method'
|
1089
|
+
options_config='force'
|
1090
|
+
options_commit='edit fetch force message'
|
1091
|
+
options_fetch='all branch remote'
|
1092
|
+
options_init='branch remote method'
|
1093
|
+
options_pull='all branch edit force message remote update'
|
1094
|
+
options_push='all branch force remote squash update'
|
1095
|
+
options_status='ALL all fetch'
|
1096
|
+
check_option() {
|
1097
|
+
local var="options_${command//-/_}"
|
1098
|
+
[[ ${!var} =~ $1 ]] ||
|
1099
|
+
usage-error "Invalid option '--$1' for '$command'."
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
#------------------------------------------------------------------------------
|
1103
|
+
# Command argument validation:
|
1104
|
+
#------------------------------------------------------------------------------
|
1105
|
+
|
1106
|
+
command-init() {
|
1107
|
+
# Export variable to let other processes (possibly git hooks) know that they
|
1108
|
+
# are running under git-subrepo. Set to current process pid, so it can be
|
1109
|
+
# further verified if need be:
|
1110
|
+
export GIT_SUBREPO_RUNNING="$$"
|
1111
|
+
export GIT_SUBREPO_COMMAND="$command"
|
1112
|
+
|
1113
|
+
: "${GIT_SUBREPO_PAGER:=${PAGER:-less}}"
|
1114
|
+
if [[ $GIT_SUBREPO_PAGER == less ]]; then
|
1115
|
+
GIT_SUBREPO_PAGER='less -FRX'
|
1116
|
+
fi
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
command-prepare() {
|
1120
|
+
local output=
|
1121
|
+
if git:rev-exists HEAD; then
|
1122
|
+
git:get-head-branch-commit
|
1123
|
+
fi
|
1124
|
+
original_head_commit="${output:-none}"
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
# Do the setup steps needed by most of the subrepo subcommands:
|
1128
|
+
command-setup() {
|
1129
|
+
get-params "$@"
|
1130
|
+
|
1131
|
+
check-and-normalize-subdir
|
1132
|
+
encode-subdir
|
1133
|
+
gitrepo="$subdir/.gitrepo"
|
1134
|
+
|
1135
|
+
if ! $force_wanted; then
|
1136
|
+
o "Check for worktree with branch subrepo/$subdir"
|
1137
|
+
local _worktree=$(git worktree list | grep "\[subrepo/$subdir\]" | cut -d ' ' -f1)
|
1138
|
+
if [[ $command =~ ^(commit)$ && -z $_worktree ]]; then
|
1139
|
+
error "There is no worktree available, use the branch command first"
|
1140
|
+
elif [[ ! $command =~ ^(branch|clean|commit|push)$ && -n $_worktree ]]; then
|
1141
|
+
if [[ -e $gitrepo ]]; then
|
1142
|
+
error "There is already a worktree with branch subrepo/$subdir.
|
1143
|
+
Use the --force flag to override this check or perform a subrepo clean
|
1144
|
+
to remove the worktree."
|
1145
|
+
else
|
1146
|
+
error "There is already a worktree with branch subrepo/$subdir.
|
1147
|
+
Use the --force flag to override this check or remove the worktree with
|
1148
|
+
1. rm -rf $_worktree
|
1149
|
+
2. git worktree prune
|
1150
|
+
"
|
1151
|
+
fi
|
1152
|
+
fi
|
1153
|
+
fi
|
1154
|
+
|
1155
|
+
# Set refs_ variables:
|
1156
|
+
refs_subrepo_branch="refs/subrepo/$subref/branch"
|
1157
|
+
refs_subrepo_commit="refs/subrepo/$subref/commit"
|
1158
|
+
refs_subrepo_fetch="refs/subrepo/$subref/fetch"
|
1159
|
+
refs_subrepo_push="refs/subrepo/$subref/push"
|
1160
|
+
|
1161
|
+
# Read/parse the .gitrepo file (unless clone/init; doesn't exist yet)
|
1162
|
+
if [[ ! $command =~ ^(clone|init)$ ]]; then
|
1163
|
+
read-gitrepo-file
|
1164
|
+
fi
|
1165
|
+
|
1166
|
+
true
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
# Parse command line args according to a simple dsl spec:
|
1170
|
+
get-params() {
|
1171
|
+
local i=0
|
1172
|
+
local num=${#command_arguments[@]}
|
1173
|
+
for arg in $@; do
|
1174
|
+
local value="${command_arguments[i]}"
|
1175
|
+
value="${value//%/%%}"
|
1176
|
+
value="${value//\\/\\\\}"
|
1177
|
+
# If arg starts with '+' then it is required
|
1178
|
+
if [[ $arg == +* ]]; then
|
1179
|
+
if [[ $i -ge $num ]]; then
|
1180
|
+
usage-error "Command '$command' requires arg '${arg#+}'."
|
1181
|
+
fi
|
1182
|
+
printf -v ${arg#+} -- "$value"
|
1183
|
+
# Look for function name after ':' to provide a default value
|
1184
|
+
else
|
1185
|
+
if [[ $i -lt $num ]]; then
|
1186
|
+
printf -v ${arg%:*} -- "$value"
|
1187
|
+
elif [[ $arg =~ : ]]; then
|
1188
|
+
"${arg#*:}"
|
1189
|
+
fi
|
1190
|
+
fi
|
1191
|
+
let i=$((i+1))
|
1192
|
+
done
|
1193
|
+
|
1194
|
+
# Check for extra arguments:
|
1195
|
+
if [[ $num -gt $i ]]; then
|
1196
|
+
set -- ${command_arguments[@]}
|
1197
|
+
for ((j = 1; j <= i; j++)); do shift; done
|
1198
|
+
error "Unknown argument(s) '$*' for '$command' command."
|
1199
|
+
fi
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
check-and-normalize-subdir() {
|
1203
|
+
# Sanity check subdir:
|
1204
|
+
[[ -n $subdir ]] ||
|
1205
|
+
die "subdir not set"
|
1206
|
+
[[ $subdir =~ ^/ || $subdir =~ ^[A-Z]: ]] &&
|
1207
|
+
usage-error "The subdir '$subdir' should not be absolute path."
|
1208
|
+
subdir="${subdir#./}"
|
1209
|
+
subdir="${subdir%/}"
|
1210
|
+
[[ $subdir != *//* ]] || subdir=$(tr -s / <<< "$subdir")
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
# Determine the correct subdir path to use:
|
1214
|
+
guess-subdir() {
|
1215
|
+
local dir="$subrepo_remote"
|
1216
|
+
dir="${dir%.git}"
|
1217
|
+
dir="${dir%/}"
|
1218
|
+
dir="${dir##*/}"
|
1219
|
+
[[ $dir =~ ^[-_a-zA-Z0-9]+$ ]] ||
|
1220
|
+
error "Can't determine subdir from '$subrepo_remote'."
|
1221
|
+
subdir="$dir"
|
1222
|
+
check-and-normalize-subdir
|
1223
|
+
encode-subdir
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
# Encode the subdir as a valid git ref format
|
1227
|
+
#
|
1228
|
+
# Input: env $subdir
|
1229
|
+
# Output: env $subref
|
1230
|
+
#
|
1231
|
+
# For detail rules about valid git refs, see the manual of git-check-ref-format:
|
1232
|
+
# URL: https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
|
1233
|
+
# Shell: git check-ref-format --help
|
1234
|
+
#
|
1235
|
+
encode-subdir() {
|
1236
|
+
subref=$subdir
|
1237
|
+
if [[ ! $subref ]] || git check-ref-format "subrepo/$subref"; then
|
1238
|
+
return
|
1239
|
+
fi
|
1240
|
+
|
1241
|
+
## 0. escape %, ensure the subref can be (almost) decoded back to subdir
|
1242
|
+
subref=${subref//%/%25}
|
1243
|
+
|
1244
|
+
## 1. They can include slash / for hierarchical (directory) grouping,
|
1245
|
+
## but no slash-separated component can begin with a dot . or
|
1246
|
+
## end with the sequence .lock.
|
1247
|
+
subref=/$subref/
|
1248
|
+
subref=${subref//\/.//%2e}
|
1249
|
+
subref=${subref//.lock\//%2elock/}
|
1250
|
+
subref=${subref#/}
|
1251
|
+
subref=${subref%/}
|
1252
|
+
|
1253
|
+
## 2. They must contain at least one /.
|
1254
|
+
## Note: 'subrepo/' be will prefixed, so this is always true.
|
1255
|
+
## 3. They cannot have two consecutive dots .. anywhere.
|
1256
|
+
subref=${subref//../%2e%2e}
|
1257
|
+
subref=${subref//%2e./%2e%2e}
|
1258
|
+
subref=${subref//.%2e/%2e%2e}
|
1259
|
+
|
1260
|
+
## 4. They cannot have ASCII control characters
|
1261
|
+
## (i.e. bytes whose values are lower than \040, or \177 DEL), space,
|
1262
|
+
## tilde ~, caret ^, or colon : anywhere.
|
1263
|
+
## 5. They cannot have question-mark ?, asterisk *,
|
1264
|
+
## or open bracket [ anywhere.
|
1265
|
+
local i
|
1266
|
+
for (( i = 1; i < 32; ++i )); do
|
1267
|
+
# skip substitute NUL char (i=0), as bash will skip NUL in env
|
1268
|
+
local x=$(printf "%02x" $i)
|
1269
|
+
subref=${subref//$(printf "%b" "\x$x")/%$x}
|
1270
|
+
done
|
1271
|
+
subref=${subref//$'\177'/%7f}
|
1272
|
+
subref=${subref// /%20}
|
1273
|
+
subref=${subref//\~/%7e}
|
1274
|
+
subref=${subref//^/%5e}
|
1275
|
+
subref=${subref//:/%3a}
|
1276
|
+
subref=${subref//\?/%3f}
|
1277
|
+
subref=${subref//\*/%2a}
|
1278
|
+
subref=${subref//\[/%5b}
|
1279
|
+
subref=${subref//$'\n'/%0a}
|
1280
|
+
|
1281
|
+
## 6. They cannot begin or end with a slash / or contain multiple
|
1282
|
+
## consecutive slashes.
|
1283
|
+
## Note: This rule is not revertable.
|
1284
|
+
[[ $subref != *//* ]] || subref=$(tr -s / <<< "$subref")
|
1285
|
+
|
1286
|
+
## 7. They cannot end with a dot ..
|
1287
|
+
case "$subref" in
|
1288
|
+
*.) subref=${subref%.}
|
1289
|
+
subref+=%2e
|
1290
|
+
;;
|
1291
|
+
esac
|
1292
|
+
|
1293
|
+
## 8. They cannot contain a sequence @\{.
|
1294
|
+
subref=${subref//@\{/%40\{}
|
1295
|
+
|
1296
|
+
## 9. They cannot be the single character @.
|
1297
|
+
## Note: 'subrepo/' be will prefixed, so this is always true.
|
1298
|
+
|
1299
|
+
## 10. They cannot contain a \.
|
1300
|
+
subref=${subref//\\/%5c}
|
1301
|
+
|
1302
|
+
subref=$(git check-ref-format --normalize --allow-onelevel "$subref") ||
|
1303
|
+
error "Can't determine valid subref from '$subdir'."
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
#------------------------------------------------------------------------------
|
1307
|
+
# State file (`.gitrepo`) functions:
|
1308
|
+
#------------------------------------------------------------------------------
|
1309
|
+
|
1310
|
+
# Set subdir and gitrepo vars:
|
1311
|
+
read-gitrepo-file() {
|
1312
|
+
gitrepo="$subdir/.gitrepo"
|
1313
|
+
|
1314
|
+
if [[ ! -f $gitrepo ]]; then
|
1315
|
+
error "No '$gitrepo' file."
|
1316
|
+
fi
|
1317
|
+
|
1318
|
+
# Read .gitrepo values:
|
1319
|
+
if [[ -z $subrepo_remote ]]; then
|
1320
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.remote
|
1321
|
+
subrepo_remote="$output"
|
1322
|
+
fi
|
1323
|
+
|
1324
|
+
if [[ -z $subrepo_branch ]]; then
|
1325
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.branch
|
1326
|
+
subrepo_branch="$output"
|
1327
|
+
fi
|
1328
|
+
|
1329
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.commit
|
1330
|
+
subrepo_commit="$output"
|
1331
|
+
|
1332
|
+
FAIL=false \
|
1333
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.parent
|
1334
|
+
subrepo_parent="$output"
|
1335
|
+
|
1336
|
+
FAIL=false \
|
1337
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.method
|
1338
|
+
if [[ $output == "rebase" ]]; then
|
1339
|
+
join_method="rebase"
|
1340
|
+
else
|
1341
|
+
# This is the default method
|
1342
|
+
join_method="merge"
|
1343
|
+
fi
|
1344
|
+
|
1345
|
+
if [[ -z $subrepo_parent ]]; then
|
1346
|
+
FAIL=false \
|
1347
|
+
SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.former
|
1348
|
+
subrepo_former="$output"
|
1349
|
+
fi
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
|
1353
|
+
# Update the subdir/.gitrepo state file:
|
1354
|
+
update-gitrepo-file() {
|
1355
|
+
local short_commit=
|
1356
|
+
|
1357
|
+
local newfile=false
|
1358
|
+
if [[ ! -e $gitrepo ]]; then
|
1359
|
+
|
1360
|
+
FAIL=false RUN git cat-file -e "$original_head_commit":"$gitrepo"
|
1361
|
+
|
1362
|
+
if OK; then
|
1363
|
+
o "Try to recreate gitrepo file from $original_head_commit"
|
1364
|
+
git cat-file -p "$original_head_commit":"$gitrepo" > "$gitrepo"
|
1365
|
+
else
|
1366
|
+
newfile=true
|
1367
|
+
cat <<... > "$gitrepo"
|
1368
|
+
; DO NOT EDIT (unless you know what you are doing)
|
1369
|
+
;
|
1370
|
+
; This subdirectory is a git "subrepo", and this file is maintained by the
|
1371
|
+
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
1372
|
+
;
|
1373
|
+
...
|
1374
|
+
fi
|
1375
|
+
fi
|
1376
|
+
|
1377
|
+
|
1378
|
+
# TODO: only update remote and branch if supplied and $update_wanted
|
1379
|
+
if $newfile || [[ $update_wanted && -n $override_remote ]]; then
|
1380
|
+
RUN git config --file="$gitrepo" subrepo.remote "$subrepo_remote"
|
1381
|
+
fi
|
1382
|
+
|
1383
|
+
if $newfile || [[ $update_wanted && -n $override_branch ]]; then
|
1384
|
+
RUN git config --file="$gitrepo" subrepo.branch "$subrepo_branch"
|
1385
|
+
fi
|
1386
|
+
|
1387
|
+
RUN git config --file="$gitrepo" subrepo.commit "$upstream_head_commit"
|
1388
|
+
# Only write new parent when we are at the head of upstream
|
1389
|
+
if [[ -n $upstream_head_commit && -n $subrepo_commit_ref ]]; then
|
1390
|
+
OUT=true RUN git rev-parse "$subrepo_commit_ref"
|
1391
|
+
o "$upstream_head_commit == $output"
|
1392
|
+
if [[ $upstream_head_commit == $output ]]; then
|
1393
|
+
RUN git config --file="$gitrepo" subrepo.parent "$original_head_commit"
|
1394
|
+
fi
|
1395
|
+
fi
|
1396
|
+
|
1397
|
+
[[ -z $join_method ]] && join_method="merge"
|
1398
|
+
RUN git config --file="$gitrepo" subrepo.method "$join_method"
|
1399
|
+
|
1400
|
+
RUN git config --file="$gitrepo" subrepo.cmdver "$VERSION"
|
1401
|
+
|
1402
|
+
RUN git add -f -- "$gitrepo"
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
#------------------------------------------------------------------------------
|
1406
|
+
# Enviroment checks:
|
1407
|
+
#------------------------------------------------------------------------------
|
1408
|
+
|
1409
|
+
# Check that system is ok for this command:
|
1410
|
+
assert-environment-ok() {
|
1411
|
+
type git &> /dev/null ||
|
1412
|
+
error "Can't find your 'git' command in '$PATH'."
|
1413
|
+
|
1414
|
+
git_version=$(git --version | cut -d ' ' -f3)
|
1415
|
+
|
1416
|
+
if [[ $(
|
1417
|
+
printf "$REQUIRED_GIT_VERSION\n$git_version" |
|
1418
|
+
sort -t. -k 1,1n -k 2,2n -k 3,3n |
|
1419
|
+
head -n1
|
1420
|
+
) == "$git_version" &&
|
1421
|
+
$git_version != "$REQUIRED_GIT_VERSION"
|
1422
|
+
]]; then
|
1423
|
+
error "Requires git version $REQUIRED_GIT_VERSION or higher; "`
|
1424
|
+
`"you have '$git_version'."
|
1425
|
+
fi
|
1426
|
+
|
1427
|
+
if [[ ${BASH_VERSINFO[0]} -lt 4 ]] ; then
|
1428
|
+
echo "The git-subrepo command requires that 'Bash 4+' is installed."
|
1429
|
+
echo "It doesn't need to be your shell, but it must be in your PATH."
|
1430
|
+
if [[ $OSTYPE == darwin* ]]; then
|
1431
|
+
echo "You appear to be on macOS."
|
1432
|
+
echo "Try: 'brew install bash'."
|
1433
|
+
echo "This will not change your user shell, it just installs 'Bash 5.x'."
|
1434
|
+
fi
|
1435
|
+
exit 1
|
1436
|
+
fi
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
# Make sure git repo is ready:
|
1440
|
+
assert-repo-is-ready() {
|
1441
|
+
# Skip this for trivial info commands:
|
1442
|
+
[[ $command =~ ^(help|version|upgrade)$ ]] && return
|
1443
|
+
|
1444
|
+
# We must be inside a git repo:
|
1445
|
+
git rev-parse --git-dir &> /dev/null ||
|
1446
|
+
error "Not inside a git repository."
|
1447
|
+
|
1448
|
+
# Get the original branch and commit:
|
1449
|
+
git:get-head-branch-name
|
1450
|
+
original_head_branch="$output"
|
1451
|
+
|
1452
|
+
# If a subrepo branch is currently checked out, then note it:
|
1453
|
+
if [[ $original_head_branch =~ ^subrepo/(.*) ]]; then
|
1454
|
+
error "Can't '$command' while subrepo branch is checked out."
|
1455
|
+
fi
|
1456
|
+
|
1457
|
+
# Make sure we are on a branch:
|
1458
|
+
[[ $original_head_branch == HEAD || -z $original_head_branch ]] &&
|
1459
|
+
error "Must be on a branch to run this command."
|
1460
|
+
|
1461
|
+
# In a work-tree:
|
1462
|
+
SAY=false OUT=true RUN git rev-parse --is-inside-work-tree
|
1463
|
+
[[ $output == true ]] ||
|
1464
|
+
error "Can't 'subrepo $command' outside a working tree."
|
1465
|
+
|
1466
|
+
# HEAD exists:
|
1467
|
+
[[ $command == clone ]] ||
|
1468
|
+
RUN git rev-parse --verify HEAD
|
1469
|
+
|
1470
|
+
assert-working-copy-is-clean
|
1471
|
+
|
1472
|
+
# For now, only support actions from top of repo:
|
1473
|
+
if [[ -n "$(git rev-parse --show-prefix)" ]]; then
|
1474
|
+
error "Need to run subrepo command from top level directory of the repo."
|
1475
|
+
fi
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
assert-working-copy-is-clean() {
|
1479
|
+
# Repo is in a clean state:
|
1480
|
+
if [[ $command =~ ^(clone|init|pull|push|branch|commit)$ ]]; then
|
1481
|
+
# TODO: Should we check for untracked files?
|
1482
|
+
local pwd=$(pwd)
|
1483
|
+
o "Assert that working copy is clean: $pwd"
|
1484
|
+
git update-index -q --ignore-submodules --refresh
|
1485
|
+
git diff-files --quiet --ignore-submodules ||
|
1486
|
+
error "Can't $command subrepo. Unstaged changes. ($pwd)"
|
1487
|
+
if [[ $command != clone ]] || git:rev-exists HEAD; then
|
1488
|
+
git diff-index --quiet --ignore-submodules HEAD ||
|
1489
|
+
error "Can't $command subrepo. Working tree has changes. ($pwd)"
|
1490
|
+
git diff-index --quiet --cached --ignore-submodules HEAD ||
|
1491
|
+
error "Can't $command subrepo. Index has changes. ($pwd)"
|
1492
|
+
else
|
1493
|
+
# Repo has no commits and we're cloning a subrepo. Working tree won't
|
1494
|
+
# possibly have changes as there was nothing initial to change.
|
1495
|
+
[[ -z $(git ls-files) ]] ||
|
1496
|
+
error "Can't $command subrepo. Index has changes. ($pwd)"
|
1497
|
+
fi
|
1498
|
+
fi
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
# If subdir exists, make sure it is empty:
|
1502
|
+
assert-subdir-ready-for-init() {
|
1503
|
+
if [[ ! -e $subdir ]]; then
|
1504
|
+
error "The subdir '$subdir' does not exist."
|
1505
|
+
fi
|
1506
|
+
if [[ -e $subdir/.gitrepo ]]; then
|
1507
|
+
error "The subdir '$subdir' is already a subrepo."
|
1508
|
+
fi
|
1509
|
+
# Check that subdir is part of the repo
|
1510
|
+
if [[ -z $(git log -1 --date=default -- $subdir) ]]; then
|
1511
|
+
error "The subdir '$subdir' is not part of this repo."
|
1512
|
+
fi
|
1513
|
+
}
|
1514
|
+
|
1515
|
+
# If subdir exists, make sure it is empty:
|
1516
|
+
assert-subdir-empty() {
|
1517
|
+
if [[ -e $subdir ]] && [[ -n $(ls -A $subdir) ]]; then
|
1518
|
+
error "The subdir '$subdir' exists and is not empty."
|
1519
|
+
fi
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
#------------------------------------------------------------------------------
|
1523
|
+
# Getters of various information:
|
1524
|
+
#------------------------------------------------------------------------------
|
1525
|
+
|
1526
|
+
# Find all the current subrepos by looking for all the subdirectories that
|
1527
|
+
# contain a `.gitrepo` file.
|
1528
|
+
get-all-subrepos() {
|
1529
|
+
local paths=($(git ls-files | sed -n 's!/\.gitrepo$!!p' | sort))
|
1530
|
+
subrepos=()
|
1531
|
+
local path
|
1532
|
+
for path in "${paths[@]}"; do
|
1533
|
+
add-subrepo "$path"
|
1534
|
+
done
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
add-subrepo() {
|
1538
|
+
if ! $ALL_wanted; then
|
1539
|
+
for path in "${subrepos[@]}"; do
|
1540
|
+
[[ $1/ =~ ^$path/ ]] && return
|
1541
|
+
done
|
1542
|
+
fi
|
1543
|
+
subrepos+=("$1")
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
# Determine the upstream's default head branch:
|
1547
|
+
get-upstream-head-branch() {
|
1548
|
+
OUT=true RUN git ls-remote $subrepo_remote
|
1549
|
+
local remotes="$output"
|
1550
|
+
[[ -n $remotes ]] ||
|
1551
|
+
error "Failed to 'git ls-remote $subrepo_remote'."
|
1552
|
+
local commit="$(
|
1553
|
+
echo "$remotes" |
|
1554
|
+
grep HEAD |
|
1555
|
+
cut -f1
|
1556
|
+
)"
|
1557
|
+
local branch="$(
|
1558
|
+
echo "$remotes" |
|
1559
|
+
grep -E "$commit[[:space:]]+refs/heads/" |
|
1560
|
+
grep -v HEAD |
|
1561
|
+
head -n1 |
|
1562
|
+
cut -f2
|
1563
|
+
)"
|
1564
|
+
[[ $branch =~ refs/heads/ ]] ||
|
1565
|
+
error "Problem finding remote default head branch."
|
1566
|
+
output="${branch#refs/heads/}"
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
# Commit msg for an action commit:
|
1570
|
+
# Don't use RUN here as it will pollute commit message
|
1571
|
+
get-commit-message() {
|
1572
|
+
local commit="none"
|
1573
|
+
if git:rev-exists "$upstream_head_commit"; then
|
1574
|
+
commit=$(git rev-parse --short "$upstream_head_commit")
|
1575
|
+
fi
|
1576
|
+
|
1577
|
+
local args=() debug_wanted=false
|
1578
|
+
if $all_wanted; then
|
1579
|
+
args+=("$subdir")
|
1580
|
+
fi
|
1581
|
+
args+=(${commit_msg_args[@]})
|
1582
|
+
|
1583
|
+
# Find the specific git-subrepo code used:
|
1584
|
+
local command_remote='???'
|
1585
|
+
local command_commit='???'
|
1586
|
+
get-command-info
|
1587
|
+
|
1588
|
+
local merged="none"
|
1589
|
+
if git:rev-exists "$subrepo_commit_ref"; then
|
1590
|
+
merged=$(git rev-parse --short "$subrepo_commit_ref")
|
1591
|
+
fi
|
1592
|
+
|
1593
|
+
local is_merge=""
|
1594
|
+
if [[ $command != push ]]; then
|
1595
|
+
if git:is_merge_commit "$subrepo_commit_ref"; then
|
1596
|
+
is_merge=" (merge)"
|
1597
|
+
fi
|
1598
|
+
fi
|
1599
|
+
|
1600
|
+
# TODO: Consider output for push!
|
1601
|
+
|
1602
|
+
# Format subrepo commit message:
|
1603
|
+
cat <<...
|
1604
|
+
git subrepo $command$is_merge ${args[@]}
|
1605
|
+
|
1606
|
+
subrepo:
|
1607
|
+
subdir: "$subdir"
|
1608
|
+
merged: "$merged"
|
1609
|
+
upstream:
|
1610
|
+
origin: "$subrepo_remote"
|
1611
|
+
branch: "$subrepo_branch"
|
1612
|
+
commit: "$commit"
|
1613
|
+
git-subrepo:
|
1614
|
+
version: "$VERSION"
|
1615
|
+
origin: "$command_remote"
|
1616
|
+
commit: "$command_commit"
|
1617
|
+
...
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
# Get location and version info about the git-subrepo command itself. This
|
1621
|
+
# info goes into commit messages, so we can find out exactly how the commits
|
1622
|
+
# were done.
|
1623
|
+
get-command-info() {
|
1624
|
+
local bin="$0"
|
1625
|
+
if [[ $bin =~ / ]]; then
|
1626
|
+
local lib="$(dirname "$bin")"
|
1627
|
+
# XXX Makefile needs to install these symlinks:
|
1628
|
+
# If `git-subrepo` was system-installed (`make install`):
|
1629
|
+
if [[ -e $lib/git-subrepo.d/upstream ]] &&
|
1630
|
+
[[ -e $lib/git-subrepo.d/commit ]]; then
|
1631
|
+
command_remote=$(readlink "$lib/git-subrepo.d/upstream")
|
1632
|
+
command_commit=$(readlink "$lib/git-subrepo.d/commit")
|
1633
|
+
elif [[ $lib =~ / ]]; then
|
1634
|
+
lib="$(dirname "$lib")"
|
1635
|
+
if [[ -d $lib/.git ]]; then
|
1636
|
+
local remote="$(
|
1637
|
+
GIT_DIR=$lib/.git git remote -v |
|
1638
|
+
grep '^origin' |
|
1639
|
+
head -n1 |
|
1640
|
+
cut -f2 |
|
1641
|
+
cut -d ' ' -f1
|
1642
|
+
)"
|
1643
|
+
if [[ -n $remote ]]; then
|
1644
|
+
command_remote="$remote"
|
1645
|
+
else
|
1646
|
+
local remote="$(
|
1647
|
+
GIT_DIR=$lib/.git git remote -v |
|
1648
|
+
head -n1 |
|
1649
|
+
cut -f2 |
|
1650
|
+
cut -d ' ' -f1
|
1651
|
+
)"
|
1652
|
+
if [[ -n $remote ]]; then
|
1653
|
+
command_remote="$remote"
|
1654
|
+
fi
|
1655
|
+
fi
|
1656
|
+
local commit="$(GIT_DIR="$lib/.git" git rev-parse --short HEAD)"
|
1657
|
+
if [[ -n $commit ]]; then
|
1658
|
+
command_commit="$commit"
|
1659
|
+
fi
|
1660
|
+
fi
|
1661
|
+
fi
|
1662
|
+
fi
|
1663
|
+
}
|
1664
|
+
|
1665
|
+
#------------------------------------------------------------------------------
|
1666
|
+
# Instructional errors:
|
1667
|
+
#------------------------------------------------------------------------------
|
1668
|
+
|
1669
|
+
error-join() {
|
1670
|
+
cat <<...
|
1671
|
+
|
1672
|
+
You will need to finish the $command by hand. A new working tree has been
|
1673
|
+
created at $worktree so that you can resolve the conflicts
|
1674
|
+
shown in the output above.
|
1675
|
+
|
1676
|
+
This is the common conflict resolution workflow:
|
1677
|
+
|
1678
|
+
1. cd $worktree
|
1679
|
+
2. Resolve the conflicts (see "git status").
|
1680
|
+
3. "git add" the resolved files.
|
1681
|
+
...
|
1682
|
+
|
1683
|
+
if [[ "$join_method" == "rebase" ]]; then
|
1684
|
+
cat <<...
|
1685
|
+
4. git rebase --continue
|
1686
|
+
...
|
1687
|
+
else
|
1688
|
+
cat <<...
|
1689
|
+
4. git commit
|
1690
|
+
...
|
1691
|
+
fi
|
1692
|
+
|
1693
|
+
cat <<...
|
1694
|
+
5. If there are more conflicts, restart at step 2.
|
1695
|
+
6. cd $start_pwd
|
1696
|
+
...
|
1697
|
+
local branch_name="${branch:=subrepo/$subdir}"
|
1698
|
+
if [[ "$command" == "push" ]]; then
|
1699
|
+
cat <<...
|
1700
|
+
7. git subrepo push $subdir $branch_name
|
1701
|
+
...
|
1702
|
+
else
|
1703
|
+
cat <<...
|
1704
|
+
7. git subrepo commit $subdir
|
1705
|
+
...
|
1706
|
+
fi
|
1707
|
+
|
1708
|
+
if [[ "$command" == "pull" && "$join_method" == "rebase" ]]; then
|
1709
|
+
cat <<...
|
1710
|
+
|
1711
|
+
After you have performed the steps above you can push your local changes
|
1712
|
+
without repeating the rebase by:
|
1713
|
+
1. git subrepo push $subdir $branch_name
|
1714
|
+
|
1715
|
+
...
|
1716
|
+
fi
|
1717
|
+
|
1718
|
+
cat <<...
|
1719
|
+
See "git help $join_method" for details.
|
1720
|
+
|
1721
|
+
Alternatively, you can abort the $command and reset back to where you started:
|
1722
|
+
|
1723
|
+
1. git subrepo clean $subdir
|
1724
|
+
|
1725
|
+
See "git help subrepo" for more help.
|
1726
|
+
|
1727
|
+
...
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
#------------------------------------------------------------------------------
|
1731
|
+
# Git command wrappers:
|
1732
|
+
#------------------------------------------------------------------------------
|
1733
|
+
|
1734
|
+
git:branch-exists() {
|
1735
|
+
git:rev-exists "refs/heads/$1"
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
git:rev-exists() {
|
1739
|
+
git rev-list "$1" -1 &> /dev/null
|
1740
|
+
}
|
1741
|
+
|
1742
|
+
git:ref-exists() {
|
1743
|
+
test -n "$(git for-each-ref "$1")"
|
1744
|
+
}
|
1745
|
+
|
1746
|
+
git:get-head-branch-name() {
|
1747
|
+
output=
|
1748
|
+
local name="$(git symbolic-ref --short --quiet HEAD)"
|
1749
|
+
[[ $name == HEAD ]] && return
|
1750
|
+
output="$name"
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
git:get-head-branch-commit() {
|
1754
|
+
output="$(git rev-parse HEAD)"
|
1755
|
+
}
|
1756
|
+
|
1757
|
+
git:commit-in-rev-list() {
|
1758
|
+
local commit="$1"
|
1759
|
+
local list_head="$2"
|
1760
|
+
git rev-list "$list_head" | grep -q "^$commit"
|
1761
|
+
}
|
1762
|
+
|
1763
|
+
git:make-ref() {
|
1764
|
+
local ref_name="$1"
|
1765
|
+
local commit="$(git rev-parse "$2")"
|
1766
|
+
RUN git update-ref "$ref_name" "$commit"
|
1767
|
+
}
|
1768
|
+
|
1769
|
+
git:is_merge_commit() {
|
1770
|
+
local commit="$1"
|
1771
|
+
git show --summary "$commit" | grep -q ^Merge:
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
git:create-worktree() {
|
1775
|
+
local branch="$1"
|
1776
|
+
worktree="$GIT_TMP/$branch"
|
1777
|
+
RUN git worktree add "$worktree" "$branch"
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
git:remove-worktree() {
|
1781
|
+
o "Remove worktree: $worktree"
|
1782
|
+
if [[ -d "$worktree" ]]; then
|
1783
|
+
o "Check worktree for unsaved changes"
|
1784
|
+
cd "$worktree"
|
1785
|
+
assert-working-copy-is-clean
|
1786
|
+
cd "$start_pwd"
|
1787
|
+
|
1788
|
+
o "Clean up worktree $worktree"
|
1789
|
+
rm -rf "$worktree"
|
1790
|
+
RUN git worktree prune
|
1791
|
+
fi
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
git:delete-branch() {
|
1795
|
+
local branch="$1"
|
1796
|
+
o "Deleting old '$branch' branch."
|
1797
|
+
# Remove worktree first, otherwise you can't delete the branch
|
1798
|
+
git:remove-worktree
|
1799
|
+
FAIL=false RUN git branch -D "$branch"
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
|
1803
|
+
#------------------------------------------------------------------------------
|
1804
|
+
# Low level sugar commands:
|
1805
|
+
#------------------------------------------------------------------------------
|
1806
|
+
|
1807
|
+
# Smart command runner:
|
1808
|
+
RUN() {
|
1809
|
+
$debug_wanted && $SAY && say '>>>' $*
|
1810
|
+
if $EXEC; then
|
1811
|
+
"$@"
|
1812
|
+
return $?
|
1813
|
+
fi
|
1814
|
+
|
1815
|
+
OK=true
|
1816
|
+
set +e
|
1817
|
+
local rc=
|
1818
|
+
local out=
|
1819
|
+
if $debug_wanted && $TTY && interactive; then
|
1820
|
+
"$@"
|
1821
|
+
else
|
1822
|
+
if $OUT; then
|
1823
|
+
out="$("$@" 2>/dev/null)"
|
1824
|
+
else
|
1825
|
+
out="$("$@" 2>&1)"
|
1826
|
+
fi
|
1827
|
+
fi
|
1828
|
+
rc=$?
|
1829
|
+
set -e
|
1830
|
+
|
1831
|
+
if [[ $rc -ne 0 ]]; then
|
1832
|
+
OK=false
|
1833
|
+
$FAIL && error "Command failed: '$*'.\n$out"
|
1834
|
+
fi
|
1835
|
+
output="$out"
|
1836
|
+
}
|
1837
|
+
|
1838
|
+
|
1839
|
+
interactive() {
|
1840
|
+
if [[ -t 0 && -t 1 ]]; then
|
1841
|
+
return 0
|
1842
|
+
else
|
1843
|
+
return 1
|
1844
|
+
fi
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
# Call a function with indent increased:
|
1848
|
+
CALL() {
|
1849
|
+
local INDENT=" $INDENT"
|
1850
|
+
"$@" || true
|
1851
|
+
}
|
1852
|
+
|
1853
|
+
# Print verbose steps for commands with steps:
|
1854
|
+
o() {
|
1855
|
+
if $verbose_wanted; then
|
1856
|
+
echo "$INDENT* $@"
|
1857
|
+
fi
|
1858
|
+
}
|
1859
|
+
|
1860
|
+
# Print unless quiet mode:
|
1861
|
+
say() {
|
1862
|
+
$quiet_wanted || echo "$@"
|
1863
|
+
}
|
1864
|
+
|
1865
|
+
# Print to stderr:
|
1866
|
+
err() {
|
1867
|
+
echo "$@" >&2
|
1868
|
+
}
|
1869
|
+
|
1870
|
+
# Check if OK:
|
1871
|
+
OK() {
|
1872
|
+
$OK
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
# Nicely report common error messages:
|
1876
|
+
usage-error() {
|
1877
|
+
local msg="git-subrepo: $1" usage=
|
1878
|
+
if [[ $GIT_SUBREPO_TEST_ERRORS != true ]]; then
|
1879
|
+
source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash"
|
1880
|
+
if can "help:$command"; then
|
1881
|
+
msg=$'\n'"$msg"$'\n'"$("help:$command")"$'\n'
|
1882
|
+
fi
|
1883
|
+
fi
|
1884
|
+
echo "$msg" >&2
|
1885
|
+
exit 1
|
1886
|
+
}
|
1887
|
+
|
1888
|
+
# Nicely report common error messages:
|
1889
|
+
error() {
|
1890
|
+
local msg="git-subrepo: $1" usage=
|
1891
|
+
echo -e "$msg" >&2
|
1892
|
+
exit 1
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
# Start at the end:
|
1896
|
+
[[ $BASH_SOURCE != "$0" ]] || main "$@"
|
1897
|
+
|
1898
|
+
# Local Variables:
|
1899
|
+
# tab-width: 2
|
1900
|
+
# sh-indentation: 2
|
1901
|
+
# sh-basic-offset: 2
|
1902
|
+
# End:
|
1903
|
+
# vim: set ft=sh sw=2 lisp:
|