-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
In the add()
function, a file's existence within the worktree is checked.
write-yourself-a-git/write-yourself-a-git.org
Lines 3280 to 3281 in 7d01174
if not (abspath.startswith(worktree) and os.path.isfile(abspath)): | |
raise Exception(f"Not a file, or outside the worktree: {paths}") |
However, this check is redundant because it has already been performed in the rm() function.
write-yourself-a-git/write-yourself-a-git.org
Lines 3186 to 3199 in 7d01174
def rm(repo, paths, delete=True, skip_missing=False): | |
# Find and read the index | |
index = index_read(repo) | |
worktree = repo.worktree + os.sep | |
# Make paths absolute | |
abspaths = set() | |
for path in paths: | |
abspath = os.path.abspath(path) | |
if abspath.startswith(worktree): | |
abspaths.add(abspath) | |
else: | |
raise Exception(f"Cannot remove paths outside of worktree: {paths}") |
Metadata
Metadata
Assignees
Labels
No labels