diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-02-09 00:28:24 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-02-09 00:28:24 +0300 |
commit | f1c95d45bd86180ef64da018b657461c44d0236a (patch) | |
tree | 27c31b4754994f1e02deb8938c0a0863ddc16096 /bpkg/fetch-git.cxx | |
parent | 19a6eb42669c2d380d0bb045fe1240b1589e9ad2 (diff) |
Fix git repository fetch that was deep regardless of the sensing result
Diffstat (limited to 'bpkg/fetch-git.cxx')
-rw-r--r-- | bpkg/fetch-git.cxx | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index a1c420a..69eb5a0 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -1397,6 +1397,8 @@ namespace bpkg fail << "unable to test if " << dir << " is shallow" << endg; }; + bool fetch_deep (fetch_repo || !dcs.empty ()); + // Print progress. // if (verb && !co.no_progress ()) @@ -1428,7 +1430,7 @@ namespace bpkg // Print warnings prior to the deep fetching. // - if (fetch_repo || !dcs.empty ()) + if (fetch_deep) { { diag_record dr (warn); @@ -1454,23 +1456,26 @@ namespace bpkg // // First, we perform the deep fetching. // - fetch (fetch_repo ? strings () : dcs, false); - - // After the deep fetching some of the shallow commits might also be - // fetched, so we drop them from the fetch list. - // - for (auto i (scs.begin ()); i != scs.end (); ) + if (fetch_deep) { - if (commit_fetched (co, dir, *i)) - i = scs.erase (i); - else - ++i; + fetch (fetch_repo ? strings () : dcs, false /* shallow */); + + // After the deep fetching some of the shallow commits might also be + // fetched, so we drop them from the fetch list. + // + for (auto i (scs.begin ()); i != scs.end (); ) + { + if (commit_fetched (co, dir, *i)) + i = scs.erase (i); + else + ++i; + } } // Finally, we perform the shallow fetching. // if (!scs.empty ()) - fetch (scs, true); + fetch (scs, true /* shallow */); // We also need to make sure that all the resulting commits are now // fetched. This may not be the case if the user misspelled the |