git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: "Jędrzej Dudkiewicz" <jedrzej.dudkiewicz@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Cannot run `git submodule init` on Cygwin from script with strict error checking
Date: Fri, 11 Sep 2020 12:30:21 +0100	[thread overview]
Message-ID: <CA+kUOan0N32W22xkoYsGYqM7rJDnc=tjQe_2Hnh2H47=19bbeQ@mail.gmail.com> (raw)
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:
>
> 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

  reply	other threads:[~2020-09-11 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  8:20 Cannot run `git submodule init` on Cygwin from script with strict error checking Jędrzej Dudkiewicz
2020-09-11 11:30 ` Adam Dinwoodie [this message]
2020-09-11 11:46   ` Jędrzej Dudkiewicz
2020-09-11 13:19     ` SZEDER Gábor
2020-09-11 19:07       ` Junio C Hamano
2020-09-15 20:31         ` SZEDER Gábor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+kUOan0N32W22xkoYsGYqM7rJDnc=tjQe_2Hnh2H47=19bbeQ@mail.gmail.com' \
    --to=adam@dinwoodie.org \
    --cc=git@vger.kernel.org \
    --cc=jedrzej.dudkiewicz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).