diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-07-04 20:08:34 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-07-31 14:38:50 +0300 |
commit | a83019dca168465a771ff4ac5999bc48b7d43cd8 (patch) | |
tree | fecf89fa82c0c4cd677d4d60edda21583640c3cf | |
parent | 3a0129b9d496e89f74cd5eef23db8a05d19bb09d (diff) |
Drop some old unused code
-rw-r--r-- | bpkg/buildfile | 2 | ||||
-rw-r--r-- | bpkg/fetch-git.cxx | 115 |
2 files changed, 1 insertions, 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: - // - // <mode><SPACE><commit><SPACE><stage><TAB><path> - // - // 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 - // <submodule-path>` 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). |