8000 respect GIT_CEILING_DIRECTORIES · pypa/setuptools-scm@979d793 · GitHub
[go: up one dir, main page]

Skip to content

Commit 979d793

Browse files
committed
respect GIT_CEILING_DIRECTORIES
Fix for #1103 When searching for the root-directory of the git repository e.g. with git rev-parse --show-toplevel, git stops the search when reaching $GIT_CEILING_DIRECTORIES. By ignoring this variable, the function _git_toplevel can go above the real git repository (e.g. when packaging a tarball without .git repository), and then runs "git archive" on an unrelated git repository. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
1 parent 9b6f031 commit 979d793

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/setuptools_scm/_file_finders/git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def _git_ls_files_and_dirs(toplevel: str) -> tuple[set[str], set[str]]:
7272
# export-ignore git attribute
7373

7474
cmd = ["git", "archive", "--prefix", toplevel + os.path.sep, "HEAD"]
75+
log.info("running %s" % " ".join(str(x) for x in cmd))
7576
proc = subprocess.Popen(
7677
cmd, stdout=subprocess.PIPE, cwd=toplevel, stderr=subprocess.DEVNULL
7778
)

src/setuptools_scm/_run_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def no_git_env(env: Mapping[str, str]) -> dict[str, str]:
9898
k: v
9999
for k, v in env.items()
100100
if not k.startswith("GIT_")
101-
or k in ("GIT_EXEC_PATH", "GIT_SSH", "GIT_SSH_COMMAND")
101+
or k in ("GIT_CEILING_DIRECTORIES", "GIT_EXEC_PATH", "GIT_SSH", "GIT_SSH_COMMAND")
102102
}
103103

104104

0 commit comments

Comments
 (0)
0