remote: simplify remote_is_configured()
authorThomas Gummerer <t.gummerer@gmail.com>
Tue, 16 Feb 2016 09:47:50 +0000 (10:47 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Feb 2016 21:33:12 +0000 (13:33 -0800)
commit674468b3642abfff7c61d5ff95fffc43b87f70b7
treebf6ab75ebd17f9588b52673007ff1b15f19bf65d
parentbc60f8a77c6e676225810f33117abcf9117b1c1e
remote: simplify remote_is_configured()

The remote_is_configured() function allows checking whether a remote
exists or not.  The function however only works if remote_get() wasn't
called before calling it.  In addition, it only checks the configuration
for remotes, but not remotes or branches files.

Make use of the origin member of struct remote instead, which indicates
where the remote comes from.  It will be set to some value if the remote
is configured in any file in the repository, but is initialized to 0 if
the remote is only created in make_remote().

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
builtin/remote.c
remote.c
remote.h