@@ -259,3 +259,52 @@ def test_update_git_tag_to_new_tag(mkgitrepo, src):
259259 result = repository .process .check_call (f"git -C { path } describe --tags" , echo = False )
260260 current_tag = result [0 ].decode ("utf8" ).strip ()
261261 assert current_tag == "2.0.0"
262+
263+
264+ def test_offline_prevents_vcs_operations (mkgitrepo , src ):
265+ """Test that offline mode prevents VCS fetch/update operations.
266+
267+ This test reproduces issue #34: offline setting should prevent VCS operations
268+ but is currently being ignored.
269+
270+ When offline=True is set (either in config or via CLI --offline flag),
271+ mxdev should NOT perform any VCS operations (no fetch, no update).
272+ """
273+ repository = mkgitrepo ("repository" )
274+ path = src / "egg"
275+
276+ # Create initial content
277+ repository .add_file ("foo" , msg = "Initial" )
278+
279+ sources = {
280+ "egg" : dict (
281+ vcs = "git" ,
282+ name = "egg" ,
283+ url = str (repository .base ),
284+ path = str (path ),
285+ )
286+ }
287+ packages = ["egg" ]
288+ verbose = False
289+
290+ # Initial checkout (not offline)
291+ vcs_checkout (sources , packages , verbose , offline = False )
292+ assert {x for x in path .iterdir ()} == {path / ".git" , path / "foo" }
293+
294+ # Add new content to remote repository
295+ repository .add_file ("bar" , msg = "Second" )
296+
297+ # Try to update with offline=True
298+ # BUG: This should NOT fetch/update anything, but currently it does
299+ # because offline parameter is ignored
300+ vcs_update (sources , packages , verbose , offline = True )
301+
302+ # After offline update, should still have only initial content (foo)
303+ # The "bar" file should NOT be present because offline prevented the update
304+ assert {x for x in path .iterdir ()} == {path / ".git" , path / "foo" }
305+
306+ # Now update with offline=False to verify update works when not offline
307+ vcs_update (sources , packages , verbose , offline = False )
308+
309+ # After normal update, should have both files
310+ assert {x for x in path .iterdir ()} == {path / ".git" , path / "foo" , path / "bar" }
0 commit comments