From 58d16fc93042dd5f50ff23a861e2115766111533 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 30 Apr 2026 16:24:52 -0700 Subject: [PATCH 1/4] cli-19: add gitignore files fix --- cecli/repo.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cecli/repo.py b/cecli/repo.py index f9f6f7467a2..b1a5d43df60 100644 --- a/cecli/repo.py +++ b/cecli/repo.py @@ -348,12 +348,26 @@ async def commit(self, fnames=None, context=None, message=None, coder_edits=Fals cmd.append("--no-verify") if fnames: fnames = [str(self.abs_root_path(fn)) for fn in fnames] + added_fnames = [] for fname in fnames: try: + # Check if file is git-ignored before trying to add + rel_fname = self.get_rel_fname(fname) + # Only skip git-ignored files if add_gitignore_files is enabled + # and we have access to coder context + if coder and hasattr(coder, 'add_gitignore_files') and coder.add_gitignore_files: + if self.git_ignored_file(rel_fname): + # Skip git-ignored files when add_gitignore_files is enabled + continue self.repo.git.add(fname) + added_fnames.append(fname) except ANY_GIT_ERROR as err: self.io.tool_error(f"Unable to add {fname}: {err}") - cmd += ["--"] + fnames + if added_fnames: + cmd += ["--"] + added_fnames + else: + # No files to commit (all were git-ignored or failed to add) + return else: cmd += ["-a"] From 7a8e70c420110c37df145237452bc9e62e6319b6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 1 May 2026 11:27:42 -0700 Subject: [PATCH 2/4] cli-19: skip gitignored files autocommit --- cecli/coders/base_coder.py | 8 +++++--- cecli/repo.py | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cecli/coders/base_coder.py b/cecli/coders/base_coder.py index 0b7f847d436..7653c80426f 100755 --- a/cecli/coders/base_coder.py +++ b/cecli/coders/base_coder.py @@ -3723,7 +3723,7 @@ async def allowed_to_edit(self, path): self.check_for_dirty_commit(path) return True - if self.repo and self.repo.git_ignored_file(path): + if self.repo and self.repo.git_ignored_file(path) and not self.add_gitignore_files: self.io.tool_warning(f"Skipping edits to {path} that matches gitignore spec.") return @@ -3742,7 +3742,8 @@ async def allowed_to_edit(self, path): # actually already part of the repo. # But let's only add if we need to, just to be safe. if need_to_add: - self.repo.repo.git.add(full_path) + if not (self.add_gitignore_files and self.repo.git_ignored_file(path)): + self.repo.repo.git.add(full_path) self.abs_fnames.add(full_path) self.check_added_files() @@ -3756,7 +3757,8 @@ async def allowed_to_edit(self, path): return if need_to_add: - self.repo.repo.git.add(full_path) + if not (self.add_gitignore_files and self.repo.git_ignored_file(path)): + self.repo.repo.git.add(full_path) self.abs_fnames.add(full_path) self.check_added_files() diff --git a/cecli/repo.py b/cecli/repo.py index b1a5d43df60..c7da3836372 100644 --- a/cecli/repo.py +++ b/cecli/repo.py @@ -352,10 +352,8 @@ async def commit(self, fnames=None, context=None, message=None, coder_edits=Fals for fname in fnames: try: # Check if file is git-ignored before trying to add - rel_fname = self.get_rel_fname(fname) - # Only skip git-ignored files if add_gitignore_files is enabled - # and we have access to coder context - if coder and hasattr(coder, 'add_gitignore_files') and coder.add_gitignore_files: + if coder and hasattr(coder, "add_gitignore_files") and coder.add_gitignore_files: + rel_fname = coder.get_rel_fname(fname) if self.git_ignored_file(rel_fname): # Skip git-ignored files when add_gitignore_files is enabled continue From 84af065760fae313c4e009d615d0f3bac7f1bb74 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 1 May 2026 12:06:03 -0700 Subject: [PATCH 3/4] cli-19: skip gitignored files autocommit --- cecli/repo.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cecli/repo.py b/cecli/repo.py index c7da3836372..9026cf4f430 100644 --- a/cecli/repo.py +++ b/cecli/repo.py @@ -353,7 +353,7 @@ async def commit(self, fnames=None, context=None, message=None, coder_edits=Fals try: # Check if file is git-ignored before trying to add if coder and hasattr(coder, "add_gitignore_files") and coder.add_gitignore_files: - rel_fname = coder.get_rel_fname(fname) + rel_fname = self.get_rel_fname(fname) if self.git_ignored_file(rel_fname): # Skip git-ignored files when add_gitignore_files is enabled continue @@ -404,6 +404,12 @@ def get_rel_repo_dir(self): except (ValueError, OSError): return self.repo.git_dir + def get_rel_fname(self, fname): + try: + return os.path.relpath(fname, self.root) + except ValueError: + return fname + async def get_commit_message(self, diffs, context, user_language=None): diffs = "# Diffs:\n" + diffs From 819a2a63693fd39f4e51ac9a2d29f6a0a3cd3c6c Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 1 May 2026 21:52:37 -0700 Subject: [PATCH 4/4] cli-19: reformatted --- cecli/repo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cecli/repo.py b/cecli/repo.py index 9026cf4f430..07ce806d0bd 100644 --- a/cecli/repo.py +++ b/cecli/repo.py @@ -352,7 +352,11 @@ async def commit(self, fnames=None, context=None, message=None, coder_edits=Fals for fname in fnames: try: # Check if file is git-ignored before trying to add - if coder and hasattr(coder, "add_gitignore_files") and coder.add_gitignore_files: + if ( + coder + and hasattr(coder, "add_gitignore_files") + and coder.add_gitignore_files + ): rel_fname = self.get_rel_fname(fname) if self.git_ignored_file(rel_fname): # Skip git-ignored files when add_gitignore_files is enabled