diff --git a/pygit2/remote.py b/pygit2/remote.py index 6a2a7b9..11bc86c 100644 --- a/pygit2/remote.py +++ b/pygit2/remote.py @@ -144,6 +144,9 @@ class Remote(object): @name.setter def name(self, value): + if not value: + raise ValueError("New remote name must be a non-empty string") + err = C.git_remote_rename(self._remote, to_str(value), ffi.NULL, ffi.NULL) check_error(err) diff --git a/test/test_remote.py b/test/test_remote.py index 54ba27c..9c95f80 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -65,6 +65,7 @@ class RepositoryTest(utils.RepoTestCase): self.assertEqual('new', remote.name) self.assertRaisesAssign(ValueError, remote, 'name', '') + self.assertRaisesAssign(ValueError, remote, 'name', None) def test_remote_set_url(self):