Skip to content

Commit b6429bc

Browse files
author
Stephan Dilly
authored
do not allow pull on local-only branch (#1067)
1 parent 1fd81b4 commit b6429bc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Added
1515
- allow reverting a commit from the commit log ([#927](https://github.com/extrawurst/gitui/issues/927))
16+
- disable pull cmd on local-only branches ([#1047](https://github.com/extrawurst/gitui/issues/1047))
1617

1718
### Fixed
1819
- Keep commit message when pre-commit hook fails ([#1035](https://github.com/extrawurst/gitui/issues/1035))

src/tabs/status.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,8 @@ impl Status {
572572
}
573573

574574
fn pull(&self) {
575-
if self.has_remotes() {
576-
if let Some(branch) = self.git_branch_name.last() {
577-
self.queue.push(InternalEvent::Pull(branch));
578-
}
575+
if let Some(branch) = self.git_branch_name.last() {
576+
self.queue.push(InternalEvent::Pull(branch));
579577
}
580578
}
581579

@@ -606,7 +604,7 @@ impl Status {
606604
}
607605

608606
fn can_pull(&self) -> bool {
609-
self.has_remotes()
607+
self.has_remotes() && self.git_branch_state.is_some()
610608
}
611609

612610
fn can_abort_merge(&self) -> bool {
@@ -875,6 +873,7 @@ impl Component for Status {
875873
Ok(EventState::Consumed)
876874
} else if k == self.key_config.keys.pull
877875
&& !self.is_focus_on_diff()
876+
&& self.can_pull()
878877
{
879878
self.pull();
880879
Ok(EventState::Consumed)

0 commit comments

Comments
 (0)