easy-worktree 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easy-worktree
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Git worktree を簡単に管理するための CLI ツール
5
5
  Project-URL: Homepage, https://github.com/igtm/easy-worktree
6
6
  Project-URL: Repository, https://github.com/igtm/easy-worktree
@@ -340,7 +340,7 @@ def create_hook_template(base_dir: Path):
340
340
  # .gitignore
341
341
  gitignore_file = wt_dir / ".gitignore"
342
342
 
343
- ignores = ["post-add.local", "config.local.toml"]
343
+ ignores = ["post-add.local", "config.local.toml", "last_selection"]
344
344
 
345
345
  if not gitignore_file.exists():
346
346
  gitignore_content = "\n".join(ignores) + "\n"
@@ -1415,7 +1415,8 @@ def cmd_select(args: list[str]):
1415
1415
  sys.exit(1)
1416
1416
 
1417
1417
  wt_dir = base_dir / ".wt"
1418
- wt_dir.mkdir(exist_ok=True)
1418
+ # Ensure .wt directory and its management files (.gitignore etc) exist
1419
+ create_hook_template(base_dir)
1419
1420
  last_sel_file = wt_dir / "last_selection"
1420
1421
 
1421
1422
  # Get current selection name based on CWD or environment
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "easy-worktree"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Git worktree を簡単に管理するための CLI ツール"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -732,5 +732,35 @@ touch hook_ran.txt
732
732
  self.assertFalse((wt_dir / "base.txt").exists(), "Should NOT have copied base.txt (overridden)")
733
733
 
734
734
 
735
+ def test_19_wt_gitignore_last_selection(self):
736
+ """Test if .wt/.gitignore contains last_selection after wt select"""
737
+ project_dir = self.test_dir / "wt-gitignore-test"
738
+ if project_dir.exists():
739
+ shutil.rmtree(project_dir)
740
+ project_dir.mkdir()
741
+ subprocess.run(["git", "init"], cwd=project_dir)
742
+ (project_dir / "README.md").write_text("Hello")
743
+ subprocess.run(["git", "add", "."], cwd=project_dir)
744
+ subprocess.run(["git", "commit", "-m", "Initial commit"], cwd=project_dir)
745
+
746
+ # wt init
747
+ self.run_wt(["init"], cwd=project_dir)
748
+
749
+ # Verify .wt/.gitignore exists and contains last_selection
750
+ wt_gitignore = project_dir / ".wt" / ".gitignore"
751
+ self.assertTrue(wt_gitignore.exists())
752
+ self.assertIn("last_selection", wt_gitignore.read_text())
753
+
754
+ # Test wt select also triggers it (though init already does)
755
+ # Remove .wt to test re-creation/initialization by select
756
+ shutil.rmtree(project_dir / ".wt")
757
+ self.assertFalse((project_dir / ".wt").exists())
758
+
759
+ # Run wt select main
760
+ self.run_wt(["select", "main"], cwd=project_dir)
761
+
762
+ self.assertTrue(wt_gitignore.exists())
763
+ self.assertIn("last_selection", wt_gitignore.read_text())
764
+
735
765
  if __name__ == "__main__":
736
766
  unittest.main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes