Skip to content

Commit

Permalink
Remove unnecessary/ineffective commands thanks to review
Browse files Browse the repository at this point in the history
  • Loading branch information
benfitzpatrick committed Jun 5, 2024
1 parent a044d52 commit 64a17e5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
19 changes: 4 additions & 15 deletions metomi/rose/loc_handlers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,9 @@ def parse(self, loc, conf_tree):
self.manager.popen.run_ok(
"git", git_dir_opt, "init"
)
self.manager.popen.run_ok(
"git", git_dir_opt, "remote", "add", "origin", remote
)

# Make sure we configure for minimum fetching.
if self.git_version >= (2, 25, 0):
self.manager.popen.run_ok(
"git", git_dir_opt, "sparse-checkout", "set", path,
"--no-cone"
)
else:
if self.git_version < (2, 25, 0):
self.manager.popen.run_ok(
"git", git_dir_opt, "config", "extensions.partialClone",
"true"
Expand All @@ -109,7 +101,7 @@ def parse(self, loc, conf_tree):
# Fetch the ref/commit as efficiently as we can.
ret_code, _, stderr = self.manager.popen.run(
"git", git_dir_opt, "fetch", "--depth=1",
"--filter=blob:none", "origin", commithash
"--filter=blob:none", remote, commithash
)
if ret_code:
raise ValueError(f"source={loc.name}: {stderr}")
Expand Down Expand Up @@ -145,21 +137,18 @@ async def pull(self, loc, conf_tree):
await self.manager.popen.run_ok_async(
"git", git_dir_opt, "init"
)
await self.manager.popen.run_ok_async(
"git", git_dir_opt, "remote", "add", "origin", remote
)
if self.git_version >= (2, 25, 0) and path != "./":
await self.manager.popen.run_ok_async(
"git", git_dir_opt, "sparse-checkout", "set", path,
"--no-cone"
)
await self.manager.popen.run_ok_async(
"git", git_dir_opt, "fetch", "--depth=1",
"--filter=blob:none", "origin", loc.key
"--filter=blob:none", remote, loc.key
)
else:
await self.manager.popen.run_ok_async(
"git", git_dir_opt, "fetch", "--depth=1", "origin", loc.key
"git", git_dir_opt, "fetch", "--depth=1", remote, loc.key
)

await self.manager.popen.run_ok_async(
Expand Down
24 changes: 23 additions & 1 deletion sphinx/api/configuration/file-creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,29 @@ root directory to install file targets with a relative path:
cloned ``REPOSITORY_URL``, git checkout'ed ``TREEISH``, and extracted
the path ``PATHSPEC`` within the clone. To extract from the root of
the repository use a ``PATHSPEC`` of ``./`` e.g.
``git:[email protected]:metomi/rose::./::2.2.0``.
``git:[email protected]:metomi/rose::./::2.2.0``. It may help to think
of the parts of the location as git:Where::What::When. Examples:

.. code-block:: rose
# Download the sphinx directory from the master branch of
# the github.com/metomi/rose repo.
[file:rose-docs]
source=git:[email protected]:metomi/rose::sphinx::master
# Extract the whole contents of version 2.0.1 of the local
# repository at /home/user/some/path/to/my/git/repo.
[file:all_of_my_repo]
source=git:/home/user/some/path/to/my/git/repo::./::2.0.1
# Extract a single file from a particular commit of a repo
# on a machine that we have ssh access to.
[file:my_file]
source=git:machine01:/data/user/my_repo_name::etc/my_file::7261bff4d9a6c582ec759ef52c46dd794fe8794e
You should set ``git config uploadpack.allowFilter true`` and
``git config uploadpack.allowAnySHA1InWant true`` on repositories
if you are setting them up to pull from.
:opt rsync: This scheme is useful for pulling a file or directory from
a remote host using ``rsync`` via ``ssh``. A URI should have the
form ``HOST:PATH``.
Expand Down

0 comments on commit 64a17e5

Please sign in to comment.