[GH-ISSUE #75] Error on simple actions #51

Closed
opened 2026-03-02 16:47:47 +03:00 by kerem · 7 comments
Owner

Originally created by @bendem on GitHub (Mar 15, 2023).
Original GitHub issue: https://github.com/initialcommit-com/git-sim/issues/75

Here is a simple reproducer of an error for a simple rebase (one root commit, two branches with one commit in each, rebase on on the other).

> git init
Initialized empty Git repository in /home/demarteaub/projects/version-sample/.git/

> git commit --allow-empty -m "initial commit"
[main (root-commit) d41bc20] initial commit

> git switch -c dev

> git commit --allow-empty -m "some development"
[dev 938ab0b] some development

> git switch main
Switched to branch 'main'

> git commit --allow-empty -m "bugfix"
[main bd7e0e7] bugfix

> git switch dev
Switched to branch 'dev'

> git_sim_media_dir=../version-sample.git-sim git-sim rebase main
Simulating: git rebase main
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:191   │
│ in rebase                                                                                        │
│                                                                                                  │
│   188 │   )                                                                                      │
│   189 ):                                                                                         │
│   190 │   scene = Rebase(branch=branch)                                                          │
│ ❱ 191 │   handle_animations(scene=scene)                                                         │
│   192                                                                                            │
│                                                                                                  │
│ ╭───────────────────────── locals ──────────────────────────╮                                    │
│ │ branch = 'main'                                           │                                    │
│ │  scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │                                    │
│ ╰───────────────────────────────────────────────────────────╯                                    │
│                                                                                                  │
│ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/animations.py:1 │
│ 7 in handle_animations                                                                           │
│                                                                                                  │
│   14                                                                                             │
│   15                                                                                             │
│   16 def handle_animations(scene: Scene) -> None:                                                │
│ ❱ 17 │   scene.render()                                                                          │
│   18 │                                                                                           │
│   19 │   if settings.video_format == "webm":                                                     │
│   20 │   │   webm_file_path = str(scene.renderer.file_writer.movie_file_path)[:-3] + "webm"      │
│                                                                                                  │
│ ╭───────────────────────── locals ─────────────────────────╮                                     │
│ │ scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │                                     │
│ ╰──────────────────────────────────────────────────────────╯                                     │
│                                                                                                  │
│ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/manim/scene/scene.py:22 │
│ 3 in render                                                                                      │
│                                                                                                  │
│    220 │   │   """                                                                               │
│    221 │   │   self.setup()                                                                      │
│    222 │   │   try:                                                                              │
│ ❱  223 │   │   │   self.construct()                                                              │
│    224 │   │   except EndSceneEarlyException:                                                    │
│    225 │   │   │   pass                                                                          │
│    226 │   │   except RerunSceneException as e:                                                  │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │ preview = False                                            │                                   │
│ │    self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
│                                                                                                  │
│ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:72 in │
│ construct                                                                                        │
│                                                                                                  │
│    69 │   │   head_commit = self.get_commit()                                                    │
│    70 │   │                                                                                      │
│    71 │   │   reached_base = False                                                               │
│ ❱  72 │   │   for commit in self.get_default_commits():                                          │
│    73 │   │   │   if commit != "dark" and self.branch in self.repo.git.branch(                   │
│    74 │   │   │   │   "--contains", commit                                                       │
│    75 │   │   │   ):                                                                             │
│                                                                                                  │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮                      │
│ │ branch_commit = <git.Commit "bd7e0e7e24bc655b1e25f73645a5b24f5823058b"> │                      │
│ │   head_commit = <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64"> │                      │
│ │  reached_base = False                                                   │                      │
│ │          self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520>        │                      │
│ ╰─────────────────────────────────────────────────────────────────────────╯                      │
│                                                                                                  │
│ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/git_sim_base_co │
│ mmand.py:68 in get_default_commits                                                               │
│                                                                                                  │
│     65 │   def get_default_commits(self):                                                        │
│     66 │   │   defaultCommits = [self.get_commit()]                                              │
│     67 │   │   for x in range(self.n_default - 1):                                               │
│ ❱   68 │   │   │   defaultCommits.append(defaultCommits[-1].parents[0])                          │
│     69 │   │   return defaultCommits                                                             │
│     70 │                                                                                         │
│     71 │   def parse_commits(                                                                    │
│                                                                                                  │
│ ╭─────────────────────────────────── locals ────────────────────────────────────╮                │
│ │ defaultCommits = [                                                            │                │
│ │                  │   <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64">, │                │
│ │                  │   <git.Commit "d41bc20b7c357301d89b3c3c515b1122850864d2">  │                │
│ │                  ]                                                            │                │
│ │           self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520>             │                │
│ │              x = 1                                                            │                │
│ ╰───────────────────────────────────────────────────────────────────────────────╯                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: tuple index out of range
Originally created by @bendem on GitHub (Mar 15, 2023). Original GitHub issue: https://github.com/initialcommit-com/git-sim/issues/75 Here is a simple reproducer of an error for a simple rebase (one root commit, two branches with one commit in each, rebase on on the other). ```console > git init Initialized empty Git repository in /home/demarteaub/projects/version-sample/.git/ > git commit --allow-empty -m "initial commit" [main (root-commit) d41bc20] initial commit > git switch -c dev > git commit --allow-empty -m "some development" [dev 938ab0b] some development > git switch main Switched to branch 'main' > git commit --allow-empty -m "bugfix" [main bd7e0e7] bugfix > git switch dev Switched to branch 'dev' > git_sim_media_dir=../version-sample.git-sim git-sim rebase main Simulating: git rebase main ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:191 │ │ in rebase │ │ │ │ 188 │ ) │ │ 189 ): │ │ 190 │ scene = Rebase(branch=branch) │ │ ❱ 191 │ handle_animations(scene=scene) │ │ 192 │ │ │ │ ╭───────────────────────── locals ──────────────────────────╮ │ │ │ branch = 'main' │ │ │ │ scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │ │ │ ╰───────────────────────────────────────────────────────────╯ │ │ │ │ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/animations.py:1 │ │ 7 in handle_animations │ │ │ │ 14 │ │ 15 │ │ 16 def handle_animations(scene: Scene) -> None: │ │ ❱ 17 │ scene.render() │ │ 18 │ │ │ 19 │ if settings.video_format == "webm": │ │ 20 │ │ webm_file_path = str(scene.renderer.file_writer.movie_file_path)[:-3] + "webm" │ │ │ │ ╭───────────────────────── locals ─────────────────────────╮ │ │ │ scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │ │ │ ╰──────────────────────────────────────────────────────────╯ │ │ │ │ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/manim/scene/scene.py:22 │ │ 3 in render │ │ │ │ 220 │ │ """ │ │ 221 │ │ self.setup() │ │ 222 │ │ try: │ │ ❱ 223 │ │ │ self.construct() │ │ 224 │ │ except EndSceneEarlyException: │ │ 225 │ │ │ pass │ │ 226 │ │ except RerunSceneException as e: │ │ │ │ ╭────────────────────────── locals ──────────────────────────╮ │ │ │ preview = False │ │ │ │ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │ │ │ ╰────────────────────────────────────────────────────────────╯ │ │ │ │ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:72 in │ │ construct │ │ │ │ 69 │ │ head_commit = self.get_commit() │ │ 70 │ │ │ │ 71 │ │ reached_base = False │ │ ❱ 72 │ │ for commit in self.get_default_commits(): │ │ 73 │ │ │ if commit != "dark" and self.branch in self.repo.git.branch( │ │ 74 │ │ │ │ "--contains", commit │ │ 75 │ │ │ ): │ │ │ │ ╭──────────────────────────────── locals ─────────────────────────────────╮ │ │ │ branch_commit = <git.Commit "bd7e0e7e24bc655b1e25f73645a5b24f5823058b"> │ │ │ │ head_commit = <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64"> │ │ │ │ reached_base = False │ │ │ │ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │ │ │ ╰─────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/git_sim_base_co │ │ mmand.py:68 in get_default_commits │ │ │ │ 65 │ def get_default_commits(self): │ │ 66 │ │ defaultCommits = [self.get_commit()] │ │ 67 │ │ for x in range(self.n_default - 1): │ │ ❱ 68 │ │ │ defaultCommits.append(defaultCommits[-1].parents[0]) │ │ 69 │ │ return defaultCommits │ │ 70 │ │ │ 71 │ def parse_commits( │ │ │ │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │ │ │ defaultCommits = [ │ │ │ │ │ <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64">, │ │ │ │ │ <git.Commit "d41bc20b7c357301d89b3c3c515b1122850864d2"> │ │ │ │ ] │ │ │ │ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> │ │ │ │ x = 1 │ │ │ ╰───────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ IndexError: tuple index out of range ```
kerem closed this issue 2026-03-02 16:47:48 +03:00
Author
Owner

@bendem commented on GitHub (Mar 15, 2023):

bisect in the hope it helps:

82f51f0cb1cc03b415690439ad6b563749788f9c is the first bad commit
commit 82f51f0cb1cc03b415690439ad6b563749788f9c
Author: Jacob Stopak <jacob@initialcommit.io>
Date:   Thu Mar 2 06:21:32 2023 -0800

    Consolidate get_commits and parse_commits methods

    Signed-off-by: Jacob Stopak <jacob@initialcommit.io>

 git_sim/add.py                  |  3 +-
 git_sim/branch.py               |  3 +-
 git_sim/cherrypick.py           | 17 ++++++------
 git_sim/commit.py               | 14 +++++-----
 git_sim/git_sim_base_command.py | 61 ++++++++++++-----------------------------
 git_sim/log.py                  | 14 ++++------
 git_sim/merge.py                | 38 +++++++++++--------------
 git_sim/rebase.py               | 21 +++++++-------
 git_sim/reset.py                |  9 +++---
 git_sim/restore.py              |  3 +-
 git_sim/revert.py               | 16 +++++------
 git_sim/stash.py                |  3 +-
 git_sim/status.py               |  3 +-
 git_sim/tag.py                  |  3 +-
 14 files changed, 82 insertions(+), 126 deletions(-)
<!-- gh-comment-id:1470244544 --> @bendem commented on GitHub (Mar 15, 2023): bisect in the hope it helps: ``` 82f51f0cb1cc03b415690439ad6b563749788f9c is the first bad commit commit 82f51f0cb1cc03b415690439ad6b563749788f9c Author: Jacob Stopak <jacob@initialcommit.io> Date: Thu Mar 2 06:21:32 2023 -0800 Consolidate get_commits and parse_commits methods Signed-off-by: Jacob Stopak <jacob@initialcommit.io> git_sim/add.py | 3 +- git_sim/branch.py | 3 +- git_sim/cherrypick.py | 17 ++++++------ git_sim/commit.py | 14 +++++----- git_sim/git_sim_base_command.py | 61 ++++++++++++----------------------------- git_sim/log.py | 14 ++++------ git_sim/merge.py | 38 +++++++++++-------------- git_sim/rebase.py | 21 +++++++------- git_sim/reset.py | 9 +++--- git_sim/restore.py | 3 +- git_sim/revert.py | 16 +++++------ git_sim/stash.py | 3 +- git_sim/status.py | 3 +- git_sim/tag.py | 3 +- 14 files changed, 82 insertions(+), 126 deletions(-) ```
Author
Owner

@initialcommit-io commented on GitHub (Mar 16, 2023):

@bendem Thanks I'll test this out and get back to you.

<!-- gh-comment-id:1471072491 --> @initialcommit-io commented on GitHub (Mar 16, 2023): @bendem Thanks I'll test this out and get back to you.
Author
Owner

@initialcommit-io commented on GitHub (Mar 16, 2023):

@bendem This also appears to be related to repos with less than 5 commits on the branch being rebased. I will try and fix this and the other related issue at the same time.

<!-- gh-comment-id:1472306484 --> @initialcommit-io commented on GitHub (Mar 16, 2023): @bendem This also appears to be related to repos with less than 5 commits on the branch being rebased. I will try and fix this and the other related issue at the same time.
Author
Owner

@initialcommit-io commented on GitHub (Mar 16, 2023):

@bendem For now, the rebase for diverged branches should work for you as long as both branches have more than 5 commits.

<!-- gh-comment-id:1472307552 --> @initialcommit-io commented on GitHub (Mar 16, 2023): @bendem For now, the rebase for diverged branches should work for you as long as both branches have more than 5 commits.
Author
Owner

@initialcommit-io commented on GitHub (Apr 1, 2023):

Just released a fix for this! Please use git-sim version 0.2.9 to take advantage of the fixes. You can upgrade git-sim with: pip install git-sim --upgrade.

I'll close this for now since it's implemented, but please let me know if you have any questions or run into any issues!

<!-- gh-comment-id:1492823155 --> @initialcommit-io commented on GitHub (Apr 1, 2023): Just released a fix for this! Please use git-sim version 0.2.9 to take advantage of the fixes. You can upgrade git-sim with: `pip install git-sim --upgrade`. I'll close this for now since it's implemented, but please let me know if you have any questions or run into any issues!
Author
Owner

@bendem commented on GitHub (Apr 3, 2023):

Awesome! This is great work.

<!-- gh-comment-id:1494948550 --> @bendem commented on GitHub (Apr 3, 2023): Awesome! This is great work.
Author
Owner

@initialcommit-io commented on GitHub (Apr 3, 2023):

@bendem There are a bunch of other new features in v0.2.9 if you want to check them out and let me know if you run into any issues or if anything is unclear 😄

  • Added new subcommands: switch, checkout, clone, fetch, pull, push
  • Detect and display filenames in merge conflicts
  • Add -m option to merge subcommand to allow user to set commit message
  • Add global flag --transparent-bg to generate output images with transparent background
<!-- gh-comment-id:1494970520 --> @initialcommit-io commented on GitHub (Apr 3, 2023): @bendem There are a bunch of other new features in v0.2.9 if you want to check them out and let me know if you run into any issues or if anything is unclear 😄 - Added new subcommands: switch, checkout, clone, fetch, pull, push - Detect and display filenames in merge conflicts - Add -m option to merge subcommand to allow user to set commit message - Add global flag --transparent-bg to generate output images with transparent background
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-sim#51
No description provided.