Skip to content

Commit 9b724cd

Browse files
Fix number of commits displayed using -n option with table/zone subcommands
Signed-off-by: Jacob Stopak <[email protected]>
1 parent 2cb2dcb commit 9b724cd

File tree

7 files changed

+11
-4
lines changed

7 files changed

+11
-4
lines changed

git_sim/add.py

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(self, files: List[str]):
1717
self.allow_no_commits = True
1818
self.files = files
1919
settings.hide_merged_branches = True
20+
self.n = self.n_default
2021

2122
try:
2223
self.selected_branches.append(self.repo.active_branch.name)
@@ -89,5 +90,6 @@ def add(
8990
help="The names of one or more files to add to Git's staging area",
9091
)
9192
):
93+
settings.hide_first_tag = True
9294
scene = Add(files=files)
9395
handle_animations(scene=scene)

git_sim/commit.py

+1
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ def commit(
116116
help="Amend the last commit message, must be used with the --message flag",
117117
),
118118
):
119+
settings.hide_first_tag = True
119120
scene = Commit(message=message, amend=amend)
120121
handle_animations(scene=scene)

git_sim/reset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
sys.exit(1)
3636

3737
self.commitsSinceResetTo = list(self.repo.iter_commits(self.commit + "...HEAD"))
38-
self.hide_first_tag = True
38+
self.n = self.n_default
3939

4040
try:
4141
self.selected_branches.append(self.repo.active_branch.name)
@@ -169,5 +169,6 @@ def reset(
169169
help="Simulate a soft reset, shortcut for --mode=hard",
170170
),
171171
):
172+
settings.hide_first_tag = True
172173
scene = Reset(commit=commit, mode=mode, soft=soft, mixed=mixed, hard=hard)
173174
handle_animations(scene=scene)

git_sim/restore.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
class Restore(GitSimBaseCommand):
1313
def __init__(self, files: List[str]):
1414
super().__init__()
15-
self.hide_first_tag = True
1615
self.files = files
1716
settings.hide_merged_branches = True
17+
self.n = self.n_default
1818

1919
try:
2020
self.selected_branches.append(self.repo.active_branch.name)
@@ -79,5 +79,6 @@ def restore(
7979
help="The names of one or more files to restore",
8080
)
8181
):
82+
settings.hide_first_tag = True
8283
scene = Restore(files=files)
8384
handle_animations(scene=scene)

git_sim/revert.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(self, commit: str):
2929
self.n = self.n_default
3030
settings.hide_merged_branches = True
3131

32-
self.hide_first_tag = True
3332
self.zone_title_offset += 0.1
3433

3534
try:
@@ -166,5 +165,6 @@ def revert(
166165
help="The ref (branch/tag), or commit ID to simulate revert",
167166
)
168167
):
168+
settings.hide_first_tag = True
169169
scene = Revert(commit=commit)
170170
handle_animations(scene=scene)

git_sim/stash.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class StashSubCommand(Enum):
1919
class Stash(GitSimBaseCommand):
2020
def __init__(self, files: List[str], command: StashSubCommand):
2121
super().__init__()
22-
self.hide_first_tag = True
2322
self.files = files
2423
self.no_files = True if not self.files else False
2524
self.command = command
2625
settings.hide_merged_branches = True
26+
self.n = self.n_default
2727

2828
try:
2929
self.selected_branches.append(self.repo.active_branch.name)
@@ -198,5 +198,6 @@ def stash(
198198
help="The name of the file to stash changes for",
199199
),
200200
):
201+
settings.hide_first_tag = True
201202
scene = Stash(files=files, command=command)
202203
handle_animations(scene=scene)

git_sim/status.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __init__(self):
1111
except TypeError:
1212
pass
1313
settings.hide_merged_branches = True
14+
self.n = self.n_default
1415

1516
def construct(self):
1617
if not settings.stdout and not settings.output_only_path and not settings.quiet:

0 commit comments

Comments
 (0)