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

Re: [BUG] git-submodule has bash-ism?

From
John Keeping <john@keeping.me.uk>
Date
Jun 1, 2016, 18:31 UTC
Message-ID
<20160601183100.GN1355@john.keeping.me.uk>
In-Reply-To
<20160601163747.GA10721@sigill.intra.peff.net>
On Wed, Jun 01, 2016 at 12:37:47PM -0400, Jeff King wrote:
Show 27 quoted lines
> On Wed, Jun 01, 2016 at 09:19:06AM -0700, Junio C Hamano wrote:
> > diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
> > index 79bc135..5503ec0 100755
> > --- a/t/t7403-submodule-sync.sh
> > +++ b/t/t7403-submodule-sync.sh
> > @@ -62,13 +62,13 @@ test_expect_success 'change submodule' '
> >  '
> >  
> >  reset_submodule_urls () {
> > -	local root
> > -	root=$(pwd) &&
> >  	(
> > +		root=$(pwd) &&
> >  		cd super-clone/submodule &&
> >  		git config remote.origin.url "$root/submodule"
> >  	) &&
> >  	(
> > +		root=$(pwd) &&
> >  		cd super-clone/submodule/sub-submodule &&
> >  		git config remote.origin.url "$root/submodule"
> 
> Hmm. Isn't $root always just going to be $TRASH_DIRECTORY here? There's
> only one caller, which appears to pass an argument which is ignored (?).
> 
> It's probably worth doing the minimal thing now and leaving further
> cleanup for a separate patch, though. Cc-ing John Keeping, the author of
> 091a6eb0feed, which added this code.

I can't shed any light on what this is trying to do; I had a look through the mailing list and this arrived in the final version of the series without any comment.

Looking at it now I can't see why this is a separate function (that is called with a parameter it never uses). I wonder if my original approach was to call this via test_when_finished from the two tests following this function definition, but that's pure speculation now.

Junio's change is obviously correct as a minimal fix.

I wonder if it's relevant that the "local root" line isn't &&-chained? Is it possible that on some shells we ignore an error but everything still works?

Previous: Jeff KingNext: Jeff King
Message 7 of 17 in “[BUG] git-submodule has bash-ism?”
  1. Junio C HamanoMay 31, 2016
  2. Stefan BellerMay 31, 2016
  3. submodule: remove bashism from shell scriptStefan Beller, Jun 1, 2016
  4. Junio C HamanoJun 1, 2016
  5. Junio C HamanoJun 1, 2016
  6. Jeff KingJun 1, 2016
  7. John KeepingJun 1, 2016
  8. Jeff KingJun 1, 2016
  9. John KeepingJun 1, 2016
  10. Junio C HamanoJun 1, 2016
  11. John KeepingJun 1, 2016
  12. Jeff KingJun 1, 2016
  13. Junio C HamanoJun 1, 2016
  14. Junio C HamanoJun 1, 2016
  15. Eric SunshineJun 1, 2016
  16. Jeff KingJun 1, 2016
  17. Stefan BellerJun 1, 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.