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

Re: [PATCH 1/3] git remote update: Report error for non-existing groups

From
Finn Arne Gangstad <finnag@pvv.org>
Date
Apr 8, 2009, 08:07 UTC
Message-ID
<20090408080738.GA24386@pvv.org>
In-Reply-To
<7vprfnubyi.fsf@gitster.siamese.dyndns.org>
On Tue, Apr 07, 2009 at 07:16:21PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Finn Arne Gangstad <finnag@pvv.org> writes:
> 
> > @@ -1227,8 +1229,11 @@ static int update(int argc, const char **argv)
> >  
> >  	remote_group.list = &list;
> >  	for (i = 1; i < argc; i++) {
> > +		int groups_found = 0;
> >  		remote_group.name = argv[i];
> > -		result = git_config(get_remote_group, NULL);
> > +		result = git_config(get_remote_group, &groups_found);
> > +		if (!groups_found && (i != 1 || strcmp(argv[1], "default")))
> > +			die("No such remote group: '%s'", argv[i]);
> 
> I think you are trying to be silent about the case where the caller feeds
> you the default_argv[] array with this, but do we want to be more explicit
> about this so that we do die when the end user explicitly says "default"
> from the command line?

Are you thinking that "git remote update default" should only be allowed if you have configured a group named default?

The old code would allow "git remote update default" and actually do the same as "git remote update", so I wanted to keep the (possibly unwanted?) behaviour. If we want to disallow it, we can just do if (!groups_found && argv != default_argv) instead.

- Finn Arne
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 10 in “git remote update: Check args and fallback to remotes”
  1. 0/3 git remote update: Check args and fallback to remotesFinn Arne Gangstad, Apr 6, 2009
  2. 1/3 git remote update: Report error for non-existing groupsFinn Arne Gangstad, Apr 6, 2009
  3. Junio C HamanoApr 8, 2009
  4. Finn Arne GangstadApr 8, 2009
  5. Junio C HamanoApr 8, 2009
  6. Jeff KingApr 8, 2009
  7. Junio C HamanoApr 8, 2009
  8. 2/3 remote: New function remote_is_configured()Finn Arne Gangstad, Apr 6, 2009
  9. 3/3 git remote update: Fallback to remote if group does not existFinn Arne Gangstad, Apr 6, 2009
  10. Jeff KingApr 6, 2009

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.