On Wed, Sep 14, 2016 at 7:03 AM, Yaroslav Halchenko <y...@onerussian.com> wrote:
> I have spent some time chasing the wild goose (well - the .gitignore
> file) after getting:
>
>     $> git-submodule add --name fcx-1 ./fcx-1/ ./fcx-1/
>     The following path is ignored by one of your .gitignore files:
>     fcx-1
>     Use -f if you really want to add it.
>
> long story short -- the culprit is this piece of code in git-submodule:
>
>     if test -z "$force" && ! git add --dry-run --ignore-missing "$sm_path" > 
> /dev/null 2>&1
>     then
>         eval_gettextln "The following path is ignored by one of your 
> .gitignore files:
> \$sm_path
> Use -f if you really want to add it." >&2
>         exit 1
>     fi
>
>
> so if anything goes wrong in git add, it just reports  this error
> message.

Thanks for the bug report!
I think we could chop off "2>&1" as that would have exposed the
underlying error.

Another way to go would be to use verbose git-add and grep for
the string "add '$sm_path'".

     if test -z "$force" && ! git add --verbose --dry-run
--ignore-missing "$sm_path" |grep "add $sm_path"

git-add already gives the correct (the same error message) for  the
ignored files, so maybe we'd just do:

    # no need for a if, but this single line will do:
    test -z "$force" && git add --dry-run git.o >/dev/null || exit 1

Reply via email to