From 1ac64611656f4ea2164606683bb034fd98f052e6 Mon Sep 17 00:00:00 2001 From: hanyujie2002 <84226578+hanyujie2002@users.noreply.github.com> Date: Mon, 2 Jun 2025 17:02:59 +0800 Subject: [PATCH] fix: `add` function redundent checking file startswith --- write-yourself-a-git.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/write-yourself-a-git.org b/write-yourself-a-git.org index f50e290..d5a81a3 100644 --- a/write-yourself-a-git.org +++ b/write-yourself-a-git.org @@ -3277,8 +3277,8 @@ index stores: creation/modification time, and so on) clean_paths = set() for path in paths: abspath = os.path.abspath(path) - if not (abspath.startswith(worktree) and os.path.isfile(abspath)): - raise Exception(f"Not a file, or outside the worktree: {paths}") + if not os.path.isfile(abspath): + raise Exception(f"Not a file") relpath = os.path.relpath(abspath, repo.worktree) clean_paths.add((abspath, relpath))