feat(panel): drop the GitHub row from the Info tab

The GitHub tab one over already names the repository and opens it; the
row only repeated it. Its upstream lookup goes with it.

Claude-Session: https://claude.ai/code/session_01Aeskbok7Ah7dvKWnaaJFEg
This commit is contained in:
l0ng-ai
2026-09-28 09:00:55 +08:00
parent 23e4ea79f5
commit 1ba9159408
2 changed files with 0 additions and 104 deletions
-68
View File
@@ -91,11 +91,6 @@ pub(crate) struct GitHubPanelState {
pub(crate) remotes: HashMap<RepoKey, RemoteLookup>,
/// The remote the user picked per repository, by remote name.
pub(crate) remote_pick: HashMap<RepoKey, String>,
/// Each checked-out branch's upstream (`origin/feat/x`, or `None` for a
/// branch never pushed), for the Info tab's link. Keyed by branch, so a
/// checkout of another branch asks again.
pub(crate) upstreams: HashMap<(RepoKey, String), Option<String>>,
pub(crate) upstream_lookups: std::collections::HashSet<(RepoKey, String)>,
pub(crate) kind: Kind,
pub(crate) state: StateFilter,
pub(crate) label: Option<String>,
@@ -408,7 +403,6 @@ impl Tty7App {
if let Some(repo) = repo {
self.github.remotes.remove(&repo);
}
self.github.upstreams.clear();
for entry in self.github.lists.values_mut() {
entry.error = None;
entry.fetched = None;
@@ -454,68 +448,6 @@ impl Tty7App {
self.github.open = None;
cx.notify();
}
/// The GitHub page for the active pane's checkout, for the Info tab: the
/// branch on the remote it tracks, or the repository when it was never
/// pushed. `None` until the lookups land, and for a tree with no GitHub
/// remote.
pub(crate) fn github_info_link(
&mut self,
branch: &str,
window: &mut Window,
cx: &mut Context<Self>,
) -> Option<(String, String)> {
let GhTarget::Ready {
repo,
remotes,
chosen,
} = self.github_target(window, cx)
else {
return None;
};
let key = (repo.clone(), branch.to_string());
let upstream = match self.github.upstreams.get(&key) {
Some(upstream) => upstream.clone(),
None => {
self.github_load_upstream(key, cx);
None
}
};
let (slug, url) =
tty7_core::core::github::remote::checkout_url(&remotes, &chosen, upstream.as_deref());
Some((slug.full(), url))
}
fn github_load_upstream(&mut self, key: (RepoKey, String), cx: &mut Context<Self>) {
if !self.github.upstream_lookups.insert(key.clone()) {
return;
}
let Some(host) = crate::ui::host_registry::HostRegistry::get(cx, key.0.host) else {
return;
};
let root = key.0.root.clone();
crate::ui::host_ops::HostOps::run(
host,
cx,
move |h| {
tty7_core::core::git::git(
h,
&root,
&["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
)
},
move |this, out, cx| {
this.github.upstream_lookups.remove(&key);
let upstream = out
.as_deref()
.map(str::trim)
.filter(|s| !s.is_empty())
.map(str::to_string);
this.github.upstreams.insert(key, upstream);
cx.notify();
},
);
}
}
/// Seconds since the epoch, for relative times.
-36
View File
@@ -355,8 +355,6 @@ enum InfoValue {
removed: u32,
open: Option<(crate::ui::host_ops::HostId, PathBuf)>,
},
/// Text that opens a web page when clicked — the repository on GitHub.
Link { text: String, url: String },
}
/// The table convention for a cell with nothing in it. Needs no translating,
@@ -424,7 +422,6 @@ impl InfoRow {
self.copy.is_some()
|| self.reveal.is_some()
|| matches!(self.value, InfoValue::Diff { open: Some(_), .. })
|| matches!(self.value, InfoValue::Link { .. })
}
}
@@ -1000,19 +997,6 @@ impl Tty7App {
copy: None,
reveal: None,
});
// The same repository on GitHub, at this branch, when one of
// its remotes is there.
if let Some((text, url)) = self.github_info_link(&git.branch, window, cx) {
rows.push(InfoRow {
label: t(L10nKey::PanelGitHubTitle),
value: InfoValue::Link {
text,
url: url.clone(),
},
copy: Some(url),
reveal: None,
});
}
}
}
@@ -1101,26 +1085,6 @@ impl Tty7App {
.child(div().min_w_0().flex_shrink(1.).truncate().child(leaf))
.into_any_element()
}
// Underlined on hover like the counts below: the row's fill says
// it reacts, the underline says the text is the button.
InfoValue::Link { text, url } => div()
.id(("panel-info-link", i))
.min_w_0()
.truncate()
.text_size(rems(TEXT))
.text_color(cx.theme().foreground)
.cursor_pointer()
.hover(|s| s.underline())
.tooltip(|window, cx| {
gpui_component::tooltip::Tooltip::new(t(L10nKey::GitHubOpenOnGitHub))
.build(window, cx)
})
.on_click(move |_, _window, cx| {
cx.stop_propagation();
cx.open_url(&url);
})
.child(text)
.into_any_element(),
InfoValue::Text(v) => div()
.flex_1()
.min_w_0()