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

Re: [PATCH 1/9] transport-helper: add 'force' to 'export' helpers

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Sep 23, 2013, 02:39 UTC
Message-ID
<523fa9df8ed1b_5c910e3e801fa@nysa.mail>
In-Reply-To
<523FAA59.6040200@bbn.com>
Richard Hansen wrote:
Show 21 quoted lines
> On 2013-08-29 11:23, Felipe Contreras wrote:
> > Otherwise they cannot know when to force the push or not (other than
> > hacks).
> > 
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> > ---
> >  transport-helper.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/transport-helper.c b/transport-helper.c
> > index 63cabc3..62051a6 100644
> > --- a/transport-helper.c
> > +++ b/transport-helper.c
> > @@ -814,6 +814,9 @@ static int push_refs_with_export(struct transport *transport,
> >  			die("helper %s does not support dry-run", data->name);
> >  	}
> >  
> > +	if (flags & TRANSPORT_PUSH_FORCE)
> > +		set_helper_option(transport, "force", "true");
> 
> Should the return value of set_helper_option() be checked?

Yeah, it would make sense. I guess we want to die() if the user does 'git push -f' and the remote helper doesn't support that.

> Also, should there be a #define TRANS_OPT_FORCE "force" with

I don't see the point of that. Defines are useful when you want to change the value string, so you don't have to change the string everywhere, but we definitely don't want to do that, as that would break backwards compatibility, so TRANS_OPT_KEEP would always be "keep" so it's just a way to tire our fingers.

> TRANS_OPT_FORCE added to boolean_options[]?
I don't see how that would help us, the only thing that would achieve is to map:
  set_helper_option(transport, "force", 1);
to
  set_helper_option(transport, "force", "true");
But we are already doing that.
Moreover, the code is already doing something similar for all the other options.
  set_helper_option(t, "progress", t->progress ? "true" : "false");
  set_helper_option(t, "verbosity", buf);
  set_helper_option(transport, "servpath", exec);
  set_helper_option(transport, "dry-run", "true");
-- 
Felipe Contreras
Previous: Richard HansenNext: Felipe Contreras
Message 4 of 20 in “transport-helper: updates”
  1. 0/9 transport-helper: updatesFelipe Contreras, Aug 29, 2013
  2. 1/9 transport-helper: add 'force' to 'export' helpersFelipe Contreras, Aug 29, 2013
  3. Richard HansenSep 23, 2013
  4. Felipe ContrerasSep 23, 2013
  5. 2/9 transport-helper: check for 'forced update' messageFelipe Contreras, Aug 29, 2013
  6. 3/9 fast-export: improve argument parsingFelipe Contreras, Aug 29, 2013
  7. 4/9 fast-export: add new --refspec optionFelipe Contreras, Aug 29, 2013
  8. Richard HansenSep 23, 2013
  9. Felipe ContrerasSep 23, 2013
  10. 5/9 transport-helper: add support for old:new refspecFelipe Contreras, Aug 29, 2013
  11. 6/9 fast-import: add support to delete refsFelipe Contreras, Aug 29, 2013
  12. 7/9 fast-export: add support to delete refsFelipe Contreras, Aug 29, 2013
  13. 8/9 transport-helper: add support to delete branchesFelipe Contreras, Aug 29, 2013
  14. Richard HansenSep 23, 2013
  15. Felipe ContrerasSep 23, 2013
  16. 9/9 transport-helper: don't update refs in dry-runFelipe Contreras, Aug 29, 2013
  17. Junio C HamanoAug 29, 2013
  18. Felipe ContrerasAug 29, 2013
  19. Richard HansenSep 23, 2013
  20. Felipe ContrerasSep 23, 2013

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.