git: Fix git_repository_name.
Without universal_newlines=True or text=True, subprocess.check_output returns bytes, not str, so it makes no sense to compare its return to "true". But upstream Git’s behavior only depends on the filename, not whether the repository is bare; emulate this more closely. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
d32d442c44
commit
34f5c4ef02
|
@ -33,11 +33,10 @@ client = zulip.Client(
|
||||||
|
|
||||||
|
|
||||||
def git_repository_name() -> str:
|
def git_repository_name() -> str:
|
||||||
output = subprocess.check_output(["git", "rev-parse", "--is-bare-repository"])
|
path, name = os.path.split(os.getcwd())
|
||||||
if output.strip() == "true":
|
if name == ".git":
|
||||||
return os.path.basename(os.getcwd())[: -len(".git")]
|
name = os.path.basename(path)
|
||||||
else:
|
return name[: -len(".git")] if name.endswith(".git") else name
|
||||||
return os.path.basename(os.path.dirname(os.getcwd()))
|
|
||||||
|
|
||||||
|
|
||||||
def git_commit_range(oldrev: str, newrev: str) -> str:
|
def git_commit_range(oldrev: str, newrev: str) -> str:
|
||||||
|
|
Loading…
Reference in a new issue