Skip to content

Commit

Permalink
feat: skip lfs smudge (#890)
Browse files Browse the repository at this point in the history
* feat: skip lfs smudge

* docs: update README

* fix: pass env to git commands
  • Loading branch information
dgarcia360 authored Sep 26, 2023
1 parent 7ae1341 commit 5487135
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 6 additions & 1 deletion extensions/sphinx-multiversion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ smv_rename_latest_version = 'latest' # Use the commit hash

### Add support for custom tags

See https://github.com/dgarcia360/sphinx-multiversion/pull/4.
See https://github.com/dgarcia360/sphinx-multiversion/pull/4

### Fix Git LFS error

See https://github.com/scylladb/scylla-enterprise/issues/3414


## Maintenance

Expand Down
2 changes: 1 addition & 1 deletion extensions/sphinx-multiversion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author="Jan Holthuis",
author_email="[email protected]",
url="https://holzhaus.github.io/sphinx-multiversion/",
version="0.2.18",
version="0.2.20",
install_requires=["sphinx >= 2.1"],
license="BSD",
packages=["sphinx_multiversion"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .main import main
from .sphinx import setup

__version__ = "0.2.13"
__version__ = "0.2.20"

__all__ = [
"setup",
Expand Down
10 changes: 6 additions & 4 deletions extensions/sphinx-multiversion/sphinx_multiversion/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@

logger = logging.getLogger(__name__)

env = os.environ.copy()
env['GIT_LFS_SKIP_SMUDGE'] = '1'

def get_toplevel_path(cwd=None):
cmd = (
"git",
"rev-parse",
"--show-toplevel",
)
output = subprocess.check_output(cmd, cwd=cwd).decode()
output = subprocess.check_output(cmd, cwd=cwd, env=env).decode()
return output.rstrip("\n")


Expand All @@ -41,7 +43,7 @@ def get_all_refs(gitroot):
"%(objectname)\t%(refname)\t%(creatordate:iso)",
"refs",
)
output = subprocess.check_output(cmd, cwd=gitroot).decode()
output = subprocess.check_output(cmd, cwd=gitroot, env=env).decode()
for line in output.splitlines():
is_remote = False
fields = line.strip().split("\t")
Expand Down Expand Up @@ -135,7 +137,7 @@ def file_exists(gitroot, refname, filename):
"{}:{}".format(refname, filename),
)
proc = subprocess.run(
cmd, cwd=gitroot, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
cmd, cwd=gitroot, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
return proc.returncode == 0

Expand All @@ -151,7 +153,7 @@ def copy_tree(gitroot, src, dst, reference, sourcepath="."):
"--",
sourcepath,
)
subprocess.check_call(cmd, cwd=gitroot, stdout=fp)
subprocess.check_call(cmd, cwd=gitroot, env=env,stdout=fp)
fp.seek(0)
with tarfile.TarFile(fileobj=fp) as tarfp:
tarfp.extractall(dst)

0 comments on commit 5487135

Please sign in to comment.