From a83019dca168465a771ff4ac5999bc48b7d43cd8 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 4 Jul 2024 20:08:34 +0300 Subject: Drop some old unused code --- bpkg/buildfile | 2 +- bpkg/fetch-git.cxx | 115 ----------------------------------------------------- 2 files changed, 1 insertion(+), 116 deletions(-) diff --git a/bpkg/buildfile b/bpkg/buildfile index 8836712..e91d0cb 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -15,7 +15,7 @@ import libs = build2%lib{build2} for m: bash bin c cc cli cxx in version import libs += build2%lib{build2-$m} -# @@ TMP we require libsqlite3 to be interface dependency of libbut-odb only +# @@ TMP we require libsqlite3 to be interface dependency of libbutl-odb only # for the database migrations to schema versions 13 and 14. # import libs += libbpkg%lib{bpkg} diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index 47b65da..5d2e5fe 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -2034,121 +2034,6 @@ namespace bpkg return r; } - // @@ TMP Old, submodule--helper-{list,name} subcommands-based, - // implementation of find_submodules(). - // -#if 0 - static submodules - find_submodules (const common_options& co, - const dir_path& dir, - const dir_path& prefix, - bool gitmodules = true) - { - tracer trace ("find_submodules"); - - submodules r; - - if (gitmodules && !exists (dir / gitmodules_file)) - return r; - - auto failure = [&prefix] (const string& d, const exception* e = nullptr) - { - submodule_failure (d, prefix, e); - }; - - fdpipe pipe (open_pipe ()); - - process pr (start_git (co, - pipe, 2 /* stderr */, - co.git_option (), - "-C", dir, - "submodule--helper", "list")); - - // Shouldn't throw, unless something is severely damaged. - // - pipe.out.close (); - - try - { - ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit); - - for (string l; !eof (getline (is, l)); ) - { - // The line describing a submodule has the following form: - // - // - // - // For example: - // - // 160000 658436a9522b5a0d016c3da0253708093607f95d 0 doc/style - // - l4 ([&]{trace << "submodule: " << l;}); - - if (!(l.size () > 50 && l[48] == '0' && l[49] == '\t')) - throw runtime_error ("invalid submodule description '" + l + '\''); - - dir_path d (string (l, 50)); - - // Note that improper submodule removal (for example, `git rm --cached - // ` was not executed) can leave git project in the - // broken state, where the module is not mentioned in .gitmodules but - // still present in the submodule--helper-list command output. Thus, - // requesting/returning the module name is not just for the caller's - // convenience but also for the repository integrity verification. - // - string n (git_line (co, "submodule name", - co.git_option (), - "-C", dir, - "submodule--helper", "name", - d)); - - // Submodule directory path is relative to the containing repository. - // - r.push_back (submodule {move (d), - move (n), - string (l, 7, 40) /* commit */}); - } - - is.close (); - - if (pr.wait ()) - return r; - - // Fall through. - } - catch (const invalid_path& e) - { - if (pr.wait ()) - failure ("invalid submodule path '" + e.path + '\''); - - // Fall through. - } - catch (const io_error& e) - { - if (pr.wait ()) - failure ("unable to read submodules list", &e); - - // Fall through. - } - // Note that the io_error class inherits from the runtime_error class, so - // this catch-clause must go last. - // - catch (const runtime_error& e) - { - if (pr.wait ()) - failure (e.what ()); - - // Fall through. - } - - // We should only get here if the child exited with an error status. - // - assert (!pr.wait ()); - - submodule_failure ("unable to list submodules", prefix); - } -#endif - // Return commit id for the submodule directory or nullopt if the submodule // is not initialized (directory doesn't exist, doesn't contain .git entry, // etc). -- cgit v1.1