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

Re: Cannot run `git submodule init` on Cygwin from script with strict error checking

From
Adam Dinwoodie <adam@dinwoodie.org>
Date
Sep 11, 2020, 11:30 UTC
Message-ID
<CA+kUOan0N32W22xkoYsGYqM7rJDnc=tjQe_2Hnh2H47=19bbeQ@mail.gmail.com>
In-Reply-To
<CABJqhQNh2Qc2Btp==bGUbT-AaSjGdGEmhtphQQyX=nqjWOis0A@mail.gmail.com>
Hi Jędrzej,
On Fri, 11 Sep 2020 at 09:20, Jędrzej Dudkiewicz wrote:
Show 45 quoted lines
>
> I'm running git 2.28.0 on Cygwin. I have a script with:
>
> set -aeu
>
> at the beginning (as all scripts should have). In the script I'm trying to run:
>
> git submodule init
>
> When running via "bash -x script.sh", I get:
>
> + git submodule init
> ++ basename /usr/libexec/git-core/git-submodule
> ++ sed -e 's/-/ /'
> + dashless='git submodule'
> + USAGE='[--quiet] [--cached]
>    or: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name
> <name>] [--reference <repository>] [--] <repository> [<path>]
>    or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
>    or: git submodule [--quiet] init [--] [<path>...]
>    or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
>    or: git submodule [--quiet] update [--init] [--remote]
> [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase]
> [--[no-]recommend-shallow] [--reference <repository>] [--recursive]
> [--[no-]single-branch] [--] [<path>...]
>    or: git submodule [--quiet] set-branch (--default|--branch
> <branch>) [--] <path>
>    or: git submodule [--quiet] set-url [--] <path> <newurl>
>    or: git submodule [--quiet] summary [--cached|--files]
> [--summary-limit <n>] [commit] [--] [<path>...]
>    or: git submodule [--quiet] foreach [--recursive] <command>
>    or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
>    or: git submodule [--quiet] absorbgitdirs [--] [<path>...]'
> + OPTIONS_SPEC=
> + SUBDIRECTORY_OK=Yes
> + . git-sh-setup
> ++ unset CDPATH
> ++ IFS='
> '
> +++ git --exec-path
> ++ . /usr/libexec/git-core/git-sh-i18n
> +++ TEXTDOMAIN=git
> +++ export TEXTDOMAIN
> /usr/libexec/git-core/git-sh-i18n: line 10: GIT_TEXTDOMAINDIR: unbound variable
> <snip>

I think there's something odd about the way you're calling `git submodule init`: it should normally be a separate execution that wouldn't inherit the `-aeu` or `-x` settings from the parent Bash process. It looks like perhaps you're `source`ing or dotting in the `git-submodule` script? Whatever it is, I think the issue is down to the way you're using `git submodule`, rather than a problem with Git or the Cygwin Git build.

I did just try to reproduce the problem using Git v2.28.0-1 on Cygwin, and wasn't able to:

``` $ cat test.sh set -aeu rm -rf testdir mkdir testdir cd testdir git init git submodule init

$ bash -x test.sh
+ set -aeu
+ rm -rf testdir
+ mkdir testdir
+ cd testdir
+ git init
Initialized empty Git repository in /home/adam/testdir/.git/
+ git submodule init

$ echo $? 0 ```

HTH
Adam
Previous: Jędrzej DudkiewiczNext: Jędrzej Dudkiewicz
Message 2 of 6 in “Cannot run `git submodule init` on Cygwin from script with strict error checking”
  1. Jędrzej DudkiewiczSep 11, 2020
  2. Adam DinwoodieSep 11, 2020
  3. Jędrzej DudkiewiczSep 11, 2020
  4. SZEDER GáborSep 11, 2020
  5. Junio C HamanoSep 11, 2020
  6. SZEDER GáborSep 15, 2020

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.