Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix some resource leaks by open file handles#1532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,9 @@
import re
import shlex
import warnings

from pathlib import Path

from gitdb.db.loose import LooseObjectDB

from gitdb.exc import BadObject
Expand DownExpand Up@@ -268,7 +271,7 @@ def __init__(
pass

try:
common_dir =open(osp.join(self.git_dir,"commondir"), "rt").readlines()[0].strip()
common_dir =(Path(self.git_dir) /"commondir").read_text().splitlines()[0].strip()
self._common_dir = osp.join(self.git_dir, common_dir)
except OSError:
self._common_dir = ""
Expand DownExpand Up@@ -1385,4 +1388,6 @@ def currently_rebasing_on(self) -> Commit | None:
rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD")
if not osp.isfile(rebase_head_file):
return None
return self.commit(open(rebase_head_file, "rt").readline().strip())
with open(rebase_head_file, "rt") as f:
content = f.readline().strip()
return self.commit(content)
3 changes: 2 additions & 1 deletiongit/repo/fun.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
from __future__ import annotations
import os
import stat
from pathlib import Path
from string import digits

from git.exc import WorkTreeRepositoryUnsupported
Expand DownExpand Up@@ -83,7 +84,7 @@ def find_worktree_git_dir(dotgit: "PathLike") -> Optional[str]:
return None

try:
lines =open(dotgit, "r").readlines()
lines =Path(dotgit).read_text().splitlines()
for key, value in [line.strip().split(": ") for line in lines]:
if key == "gitdir":
return value
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp