Merge branch 'main' into indent-bad-edit

This commit is contained in:
Paul Gauthier 2023-08-08 12:43:57 -03:00
commit 77be993708
14 changed files with 150 additions and 49 deletions

View file

@ -1 +1 @@
__version__ = "0.11.1-dev"
__version__ = "0.11.2-dev"

View file

@ -365,8 +365,8 @@ class Coder:
if not self.summarizer.too_big(self.done_messages):
return
assert self.summarizer_thread is None
assert self.summarized_done_messages is None
self.summarize_end()
if self.verbose:
self.io.tool_output("Starting to summarize chat history.")
@ -653,6 +653,9 @@ class Coder:
live.start()
for chunk in completion:
if len(chunk.choices) == 0:
continue
if chunk.choices[0].finish_reason == "length":
raise ExhaustedContextWindow()
@ -672,11 +675,11 @@ class Coder:
if text:
self.partial_response_content += text
except AttributeError:
pass
text = None
if self.pretty:
self.live_incremental_response(live, False)
else:
elif text:
sys.stdout.write(text)
sys.stdout.flush()
finally:

View file

@ -350,8 +350,9 @@ class Commands:
combined_output = None
try:
parsed_args = shlex.split("git " + args)
env = dict(GIT_EDITOR="true", **subprocess.os.environ)
result = subprocess.run(
parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, env=env
)
combined_output = result.stdout
except Exception as e:

View file

@ -126,19 +126,11 @@ class GitRepo:
return commit_message
def get_diffs(self, pretty, *args):
try:
commits = self.repo.iter_commits(self.repo.active_branch)
current_branch_has_commits = any(commits)
except git.exc.GitCommandError:
current_branch_has_commits = False
if not current_branch_has_commits:
return ""
# we always want diffs of working-dir + index versus repo
args = ["--cached"] + list(args)
if pretty:
args = ["--color"] + list(args)
if not args:
args = ["HEAD"]
diffs = self.repo.git.diff(*args)
return diffs

View file

@ -307,6 +307,10 @@ class RepoMap:
self.cache_missing = False
for fname in fnames:
if not Path(fname).is_file():
self.io.tool_error(f"Repo-map can't include {fname}")
continue
# dump(fname)
rel_fname = os.path.relpath(fname, self.root)