golang / dep

Go dependency management tool experiment (deprecated)
https://golang.github.io/dep/
BSD 3-Clause "New" or "Revised" License
12.86k stars 1.05k forks source link

Fix clean of submodules #2168

Closed geaaru closed 5 years ago

geaaru commented 5 years ago

Fix execution with the vendor with submodules.

What does this do / why do we need it?

This fix error:

#$# dep ensure -add github.com/openSUSE/umoci
Fetching sources...

Solving failure: No versions of github.com/openSUSE/umoci met constraints:
    v0.3.1: Could not introduce github.com/openSUSE/umoci@v0.3.1, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.4.4: Could not introduce github.com/openSUSE/umoci@v0.4.4, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.4.3: Could not introduce github.com/openSUSE/umoci@v0.4.3, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.4.2: Could not introduce github.com/openSUSE/umoci@v0.4.2, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.4.1: Could not introduce github.com/openSUSE/umoci@v0.4.1, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.4.0: Could not introduce github.com/openSUSE/umoci@v0.4.0, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.3.0: Could not introduce github.com/openSUSE/umoci@v0.3.0, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.2.1: Could not introduce github.com/openSUSE/umoci@v0.2.1, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.2.0: Could not introduce github.com/openSUSE/umoci@v0.2.0, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.1.0: Could not introduce github.com/openSUSE/umoci@v0.1.0, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.0.0: Could not introduce github.com/openSUSE/umoci@v0.0.0, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.0.0-rc3: Could not introduce github.com/openSUSE/umoci@v0.0.0-rc3, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.0.0-rc2: Could not introduce github.com/openSUSE/umoci@v0.0.0-rc2, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    v0.0.0-rc1: Could not introduce github.com/openSUSE/umoci@v0.0.0-rc1, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master

    master: unexpected error while defensively cleaning up after possible derelict nested submodule directories: Entering '.site/themes/hugo-theme-learn'
error: unknown switch `x'
uso: git submodule--helper foreach [--quiet] [--recursive] <command>

    -q, --quiet           Suppress output of entering each submodule command
    --recursive           Recurse into nested submodules

fatal: run_command returned non-zero status while recursing in the nested submodules of .site/themes/hugo-theme-learn
.
: command failed: [git submodule foreach --recursive git clean -x -d -f -f]: exit status 128
    gh-pages: Could not introduce github.com/openSUSE/umoci@gh-pages, as it is not allowed by constraints from the following projects:
    master from (root)
    master from github.com/geaaru/docker-companion@master
googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

geaaru commented 5 years ago

I signed it!

googlebot commented 5 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

googlebot commented 5 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

kevinburke commented 5 years ago

Hey, I can't reproduce this issue, can you describe what you did to test this change? I'm a little confused because you should be able to write the command with spaces in between, after the "foreach" instead of needing to list it all as one command.

Maybe we need a "--" ?

aaronjwood commented 5 years ago

I never used to hit this in my projects that have submodules but I hit it now. The only thing that has changed on my end is my git version. I upgraded git via brew a few days ago:

$ git --version
git version 2.22.0

My dep version hasn't changed:

$ dep version
dep:
 version     : v0.5.3
 build date  : 2019-05-19
 git hash    : 192eb44
 go version  : go1.12.5
 go compiler : gc
 platform    : darwin/amd64
 features    : ImportDuringSolve=false
geaaru commented 5 years ago

Hi,

in my case I have:

$ git --version
git version 2.21.0
geaaru commented 5 years ago

You could reproduce it directly with git and the repository that I wrote:

$# git clone https://github.com/openSUSE/umoci.git
$# git submodule foreach --recursive git clean -x -d -f -f
Entering '.site/themes/hugo-theme-learn'
error: unknown switch `x'

$# # right way with avoid use of clean option directly
$# git submodule foreach --recursive "git clean -x -d -f -f"
Entering '.site/themes/hugo-theme-learn'

In summary, if you avoid assembling the git clean options then the options are seen as git submodule options and this break the execution.

kevinburke commented 5 years ago

OK

kevinburke commented 5 years ago

OK