File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class Source:
2424 | --- | ------- | -------- | ------- |
2525 | `repo` | URL of the repository | Yes |
2626 | `name` | Directory for checkout | Yes | (inferred) |
27- | `rev` | SHA, tag, or branch to checkout | Yes | `"main "`|
27+ | `rev` | SHA, tag, or branch to checkout | Yes | `"HEAD "`|
2828 | `type` | `"git"` or `"git-svn"` | No | `"git"` |
2929 | `params` | Additional arguments for `clone` | No | `null` |
3030 | `sparse_paths` | Controls partial checkout | No | `[]` |
@@ -66,7 +66,7 @@ class Source:
6666
6767 repo : str = ""
6868 name : Optional [str ] = None
69- rev : str = "main "
69+ rev : str = "HEAD "
7070
7171 type : str = "git"
7272 params : Optional [str ] = None
@@ -84,6 +84,8 @@ def __post_init__(self):
8484 else :
8585 self .name = str (self .name )
8686 self .type = self .type or "git"
87+ if not self .rev :
88+ self .rev = "HEAD"
8789
8890 def __repr__ (self ):
8991 return f"<source { self } >"
Original file line number Diff line number Diff line change @@ -20,7 +20,12 @@ def test_init_defaults(self):
2020
2121 assert "http://example.com/foo/bar.git" == source .repo
2222 assert "bar" == source .name
23- assert "main" == source .rev
23+ assert "HEAD" == source .rev
24+
25+ def test_init_invalid_rev_default_gets_corrected (self ):
26+ source = Source (type = "git" , repo = "http://example.com/foo/bar.git" , rev = None )
27+
28+ assert "HEAD" == source .rev
2429
2530 def test_init_name_as_path (self , tmp_path ):
2631 """Verify the name can be a path."""
You can’t perform that action at this time.
0 commit comments