Skip to content

Commit 8be4f1b

Browse files
committed
feat: gix remote ref-map makes clear which specs are implicit.
Normally refspecs are coming from the configuration only, but now implied specs due to the implicit include-tag feature also matter.
1 parent 2571dc8 commit 8be4f1b

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

gitoxide-core/src/repository/fetch.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ pub(crate) mod function {
102102
if mapping.spec_index != last_spec_index {
103103
last_spec_index = mapping.spec_index;
104104
spec.to_ref().write_to(&mut out)?;
105+
let is_implicit = mapping.spec_index.implicit_index().is_some();
106+
if is_implicit {
107+
write!(&mut out, " (implicit")?;
108+
if spec.to_ref()
109+
== git::remote::fetch::Tags::Included
110+
.to_refspec()
111+
.expect("always yields refspec")
112+
{
113+
write!(&mut out, ", due to auto-tag")?;
114+
}
115+
write!(&mut out, ")")?;
116+
}
105117
writeln!(out)?;
106118
}
107119

@@ -118,7 +130,7 @@ pub(crate) mod function {
118130
Some(edit) => {
119131
writeln!(out, " -> {} [{}]", edit.name, update.mode)
120132
}
121-
None => writeln!(out, " (fetch only)"),
133+
None => writeln!(out, " [{}]", update.mode),
122134
}?;
123135
}
124136
if !map.fixes.is_empty() {

gitoxide-core/src/repository/remote.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ mod refs_impl {
126126
.get(refspecs, &map.extra_refspecs)
127127
.expect("refspecs here are the ones used for mapping");
128128
spec.to_ref().write_to(&mut out)?;
129+
let is_implicit = mapping.spec_index.implicit_index().is_some();
130+
if is_implicit {
131+
write!(&mut out, " (implicit")?;
132+
if spec.to_ref()
133+
== git::remote::fetch::Tags::Included
134+
.to_refspec()
135+
.expect("always yields refspec")
136+
{
137+
write!(&mut out, ", due to auto-tag")?;
138+
}
139+
write!(&mut out, ")")?;
140+
}
129141
writeln!(out)?;
130142
}
131143

@@ -203,7 +215,7 @@ mod refs_impl {
203215
}
204216
}
205217
if refspecs.is_empty() {
206-
bail!("Without ref-specs there is nothing to show here. Add ref-specs as arguments or configure them in git-config.")
218+
bail!("Without refspecs there is nothing to show here. Add refspecs as arguments or configure them in git-config.")
207219
}
208220
Ok(())
209221
}

0 commit comments

Comments
 (0)