git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] remote: simplify remote_is_configured()

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Feb 15, 2016, 20:38 UTC
Message-ID
<20160215203846.GD13775@hank>
In-Reply-To
<20160215182113.GF26443@sigill.intra.peff.net>
On 02/15, Jeff King wrote:
Show 31 quoted lines
> On Mon, Feb 15, 2016 at 06:42:28PM +0100, Thomas Gummerer wrote:
>
> > 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().
>
> Makes sense. I wonder if we would want to give this an explicit slot in
> the enum. I.e.:
>
> > diff --git a/remote.h b/remote.h
> > index 4fd7a0f..7a5ee77 100644
> > --- a/remote.h
> > +++ b/remote.h
> > @@ -5,7 +5,7 @@
> >  #include "hashmap.h"
> >
> >  enum {
> > -	REMOTE_CONFIG,
> > +	REMOTE_CONFIG = 1,
> >  	REMOTE_REMOTES,
> >  	REMOTE_BRANCHES
> >  };
>
> Add in "REMOTE_UNCONFIGURED = 0" here. It makes no difference to
> correctness, but is perhaps documents what is going on a bit better.
Agreed, will change.  Thanks.
>
> -Peff
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 18 in “git remote improvements”
  1. 0/4 git remote improvementsThomas Gummerer, Feb 15, 2016
  2. 1/4 remote: use skip_prefixThomas Gummerer, Feb 15, 2016
  3. Jeff KingFeb 15, 2016
  4. Eric SunshineFeb 15, 2016
  5. Jeff KingFeb 15, 2016
  6. Thomas GummererFeb 15, 2016
  7. 2/4 remote: simplify remote_is_configured()Thomas Gummerer, Feb 15, 2016
  8. Jeff KingFeb 15, 2016
  9. Thomas GummererFeb 15, 2016
  10. Junio C HamanoFeb 15, 2016
  11. 3/4 remote: actually check if remote exitsThomas Gummerer, Feb 15, 2016
  12. Jeff KingFeb 15, 2016
  13. 4/4 remote: use remote_is_configured() for add and renameThomas Gummerer, Feb 15, 2016
  14. Jeff KingFeb 15, 2016
  15. Thomas GummererFeb 15, 2016
  16. Johannes SchindelinFeb 17, 2016
  17. Thomas GummererFeb 17, 2016
  18. Johannes SchindelinFeb 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.