Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: publish: Tell git-fetch to not recurse into submodules #4560

Merged
merged 1 commit into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datalad/distribution/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _check_and_update_remote_server_info(ds, remote):

def _maybe_fetch(repo, remote):
if repo.config.get("remote.{}.fetch".format(remote)):
repo.fetch(remote=remote)
repo.fetch(remote=remote, recurse_submodules="no")
else:
# Fetching would lead to "Couldn't find remote ref HEAD" if no
# branch" error. See gh-4199 for an example.
Expand Down
26 changes: 26 additions & 0 deletions datalad/distribution/tests/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,3 +731,29 @@ def test_publish_no_fetch_refspec_configured(path):
(ds.repo.pathobj / "foo").write_text("a")
ds.save()
ds.publish(to="origin")


@skip_ssh
@with_tempfile(mkdir=True)
def test_publish_fetch_do_not_recurse_submodules(path):
# This sets up a situation where git (2.26.2 at the time of writing) will
# fail trying to fetch a non-existent 'origin' remote if
# --no-recurse-submodules is not set during the fetch.
path = Path(path)
ds_a = Dataset(path / "a").create()
ds_a.create("sub")
ds_a.save(recursive=True)
# TODO: This can be switched to a local path on master, dropping the
# skip_ssh().
ds_a.create_sibling("ssh://datalad-test:{}/b".format(path), name="b",
recursive=True)
publish(dataset=ds_a, to="b")

ds_b = Dataset(path / "b")
ds_b.repo.checkout("other", options=["-b"])
(ds_b.pathobj / "sub" / "foo").write_text("foo")
ds_b.save(recursive=True)

(ds_a.pathobj / "bar").write_text("bar")
ds_a.save()
assert_status("ok", publish(dataset=ds_a, to="b"))