From: Johannes Schindelin Date: Wed, 19 Mar 2008 00:27:42 +0000 (+0000) Subject: remote show: do not show symbolic refs X-Git-Tag: v1.5.5-rc1~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=740fdd27f0888d5c80ef6a550734bdc53febd2df;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-remote.c b/builtin-remote.c index 24e692953..9c1517303 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -207,7 +207,10 @@ static int handle_one_branch(const char *refname, if (!remote_find_tracking(states->remote, &refspec)) { struct path_list_item *item; const char *name = skip_prefix(refspec.src, "refs/heads/"); - if (unsorted_path_list_has_path(&states->tracked, name) || + /* symbolic refs pointing nowhere were handled already */ + if ((flags & REF_ISSYMREF) || + unsorted_path_list_has_path(&states->tracked, + name) || unsorted_path_list_has_path(&states->new, name)) return 0; diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index ecfc999aa..004a8dc5e 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -237,4 +237,14 @@ test_expect_success 'update default (overridden, with funny whitespace)' ' ' +test_expect_success '"remote show" does not show symbolic refs' ' + + git clone one three && + (cd three && + git remote show origin > output && + ! grep HEAD < output && + ! grep -i stale < output) + +' + test_done