remote show: do not show symbolic refs
For symbolic refs, a sane notion of being "stale" is that the ref they point to no longer exists. Since this is checked already, "remote show" does not need to show them at all. Incidentally, this fixes the issue that "HEAD" was shown as a stale ref by "remote show" in a freshly cloned repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Mar 19, 2008 at 00:27 UTC
740fdd27f0888d5c80ef6a550734bdc53febd2df
2 files changed
+14
-1
builtin-remote.c
+4
-1
@@ -207,7 +207,10 @@ static int handle_one_branch(const char *refname,
207
if (!remote_find_tracking(states->remote, &refspec)) {
208
struct path_list_item *item;
209
const char *name = skip_prefix(refspec.src, "refs/heads/");
210
- if (unsorted_path_list_has_path(&states->tracked, name) ||
210
+ /* symbolic refs pointing nowhere were handled already */
211
+ if ((flags & REF_ISSYMREF) ||
212
+ unsorted_path_list_has_path(&states->tracked,
213
+ name) ||
214
unsorted_path_list_has_path(&states->new,
215
name))
216
return 0;
t/t5505-remote.sh
+10
@@ -237,4 +237,14 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
237
238
'
239
240
+test_expect_success '"remote show" does not show symbolic refs' '
241
+
242
+ git clone one three &&
243
+ (cd three &&
244
+ git remote show origin > output &&
245
+ ! grep HEAD < output &&
246
+ ! grep -i stale < output)
247
+
248
+'
249
+
250
test_done