diff options
-rw-r--r-- | bpkg/fetch-git.cxx | 8 | ||||
-rw-r--r-- | tests/rep-fetch-git-commit.test | 14 | ||||
-rw-r--r-- | tests/rep-fetch.test | 6 |
3 files changed, 19 insertions, 9 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index a60a160..a9a548e 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -919,7 +919,13 @@ namespace bpkg fetch_warn (cap, single_branch ? "branch" : "repository"); dir_path d (destdir); - d /= dir_path (ref.branch ? *ref.branch : *ref.commit); + + // Truncate commit id-based directory names to shorten the absolute + // directory path to lower probability of hitting the limit on Windows. + // Note that we can't do the same for branch/tag names as chances to clash + // would be way higher. Though such names are normally short anyway. + // + d /= dir_path (ref.branch ? *ref.branch : ref.commit->substr (0, 16)); strings to (timeout_opts (co, url.scheme)); diff --git a/tests/rep-fetch-git-commit.test b/tests/rep-fetch-git-commit.test index ced0f8f..e2752b6 100644 --- a/tests/rep-fetch-git-commit.test +++ b/tests/rep-fetch-git-commit.test @@ -8,7 +8,7 @@ reason_unadv = ' (unadvertised commit)' warn_dumb=' warning: fetching over dumb HTTP, no progress will be shown' - +git clone "$rep_git/state0/style-basic.git" 2>! &style-basic/*** ++git clone "$rep_git/state0/style-basic.git" 2>! &style-basic/*** : unadvertised : @@ -16,6 +16,10 @@ warning: fetching over dumb HTTP, no progress will be shown' +git -C ../style-basic log '--pretty=format:%H' --all --grep='README' | \ set commit + +git -C ../style-basic log '--pretty=format:%h' --all --grep='README' \ + --abbrev=16 | \ + set abbr_commit + : no-branch : { @@ -23,7 +27,7 @@ warning: fetching over dumb HTTP, no progress will be shown' if ($git_protocol == 'https-smart-unadv') warn = '%.{0}' - fetch = "%Fetching in '.+$commit'.+%" + fetch = "%Fetching in '.+$abbr_commit'.+%" else warn = "warning: fetching whole repository history" @@ -39,7 +43,7 @@ warning: fetching over dumb HTTP, no progress will be shown' $* 2>>~"%EOE%" %fetching git:.+style-basic% $warn - %Cloning into '.+$commit'.+% + %Cloning into '.+$abbr_commit'.+% $fetch 0 package\(s\) in 1 repository\(s\) EOE @@ -91,13 +95,13 @@ warning: fetching over dumb HTTP, no progress will be shown' fetch = '%.{0}' else warn = '%.{0}' - fetch = "%Fetching in '.+$commit'.+%" + fetch = "%Fetching in '.+$abbr_commit'.+%" end; $* 2>>~"%EOE%" %fetching git:.+style-basic% $warn - %Cloning into '.+$commit'.+% + %Cloning into '.+$abbr_commit'.+% $fetch 0 package\(s\) in 1 repository\(s\) EOE diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test index e18c8fa..f3732e6 100644 --- a/tests/rep-fetch.test +++ b/tests/rep-fetch.test @@ -79,7 +79,7 @@ $x $src/git/state1/style-basic.tar &$out_git/state1/*** end -: no-repositories +: no-repos : $clone_cfg; $* 2>>/EOE != 0 @@ -87,7 +87,7 @@ $* 2>>/EOE != 0 info: use 'bpkg rep-add' to add a repository EOE -: bpkg-repositories +: bpkg-repos : { test.options += --auth all @@ -161,7 +161,7 @@ $* 2>>/EOE != 0 } } -: git-repositories +: git-repos : if ($remote != true) { |