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

Re: [PATCH] push: propagate push-options with --recurse-submodules

From
BWBrandon Williams <bmwill@google.com>
Date
Mar 31, 2017, 23:26 UTC
Message-ID
<20170331232631.GA40772@google.com>
In-Reply-To
<20170331232030.GA8741@aiede.mtv.corp.google.com>
On 03/31, Jonathan Nieder wrote:
Show 21 quoted lines
> Hi,
> 
> Brandon Williams wrote:
> 
> > Teach push --recurse-submodules to propagate push-options recursively to
> > the pushes performed in the submodules.
> 
> Sounds like a good change.
> 
> [...]
> > +++ b/submodule.c
> [...]
> > @@ -793,6 +794,12 @@ static int push_submodule(const char *path, int dry_run)
> >  		if (dry_run)
> >  			argv_array_push(&cp.args, "--dry-run");
> >  
> > +		if (push_options && push_options->nr) {
> > +			static struct string_list_item *item;
> 
> Why static?  It would be simpler (and would use less bss) to let this
> pointer be an automatic variable instead.
Oops, definitely shouldn't be static! Thanks for catching that.
Show 18 quoted lines
> 
> > +			for_each_string_list_item(item, push_options)
> > +				argv_array_pushf(&cp.args, "--push-option=%s",
> > +						 item->string);
> > +		}
> >  		prepare_submodule_repo_env(&cp.env_array);
> >  		cp.git_cmd = 1;
> >  		cp.no_stdin = 1;
> > @@ -807,7 +814,8 @@ static int push_submodule(const char *path, int dry_run)
> >  
> >  int push_unpushed_submodules(struct sha1_array *commits,
> >  			     const char *remotes_name,
> > -			     int dry_run)
> > +			     int dry_run,
> > +			     const struct string_list *push_options)
> 
> nit: I wonder if dry_run should stay as the last argument.  That would
> make it closer to the idiom of have a flag word as last argument.
Yeah I can flip the order.
Show 13 quoted lines
> 
> [...]
> > +++ b/t/t5545-push-options.sh
> > @@ -142,6 +142,45 @@ test_expect_success 'push options work properly across http' '
> >  	test_cmp expect actual
> >  '
> >  
> > +test_expect_success 'push options and submodules' '
> 
> Yay!
> 
> What happens if the upstream of the parent repo supports push options
> but the upstream of the child repo doesn't?  What should happen?
push would fail since the children are pushed first.
> 
> Thanks and hope that helps,
> Jonathan
-- 
Brandon Williams
Previous: Jonathan NiederNext: Brandon Williams
Message 3 of 19 in “push: propagate push-options with --recurse-submodules”
  1. push: propagate push-options with --recurse-submodulesBrandon Williams, Mar 31, 2017
  2. Jonathan NiederMar 31, 2017
  3. Brandon WilliamsMar 31, 2017
  4. 0/2 propagate push-optionsBrandon Williams, Mar 31, 2017
  5. 1/2 push: unmark a local variable as staticBrandon Williams, Mar 31, 2017
  6. Jonathan NiederApr 1, 2017
  7. Brandon WilliamsApr 1, 2017
  8. 2/2 push: propagate push-options with --recurse-submodulesBrandon Williams, Mar 31, 2017
  9. Jonathan NiederApr 1, 2017
  10. Jacob KellerApr 6, 2017
  11. Brandon WilliamsApr 6, 2017
  12. 0/5 propagating push-options, remote and refspecBrandon Williams, Apr 5, 2017
  13. 2/5 push: propagate push-options with --recurse-submodulesBrandon Williams, Apr 5, 2017
  14. 5/5 push: propagate remote and refspec with --recurse-submodulesBrandon Williams, Apr 5, 2017
  15. 4/5 submodule--helper: add push-check subcommandBrandon Williams, Apr 5, 2017
  16. 1/5 push: unmark a local variable as staticBrandon Williams, Apr 5, 2017
  17. 3/5 remote: expose parse_push_refspec functionBrandon Williams, Apr 5, 2017
  18. Junio C HamanoApr 11, 2017
  19. Brandon WilliamsApr 11, 2017

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.