File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ Available options and flags include:
65
65
` --diverge-at ` : The commit number at which branches diverge from ` main ` .
66
66
` --merge ` : A comma separated list of branch postfix ids to merge back into ` main ` .
67
67
` --git-dir ` : The path at which to store the dummy Git repo, defaults to current directory.
68
+ ` --no-subdir ` : Initialize the dummy Git repo in the current directory instead of in a subdirectory.
68
69
69
70
## Command examples
70
71
Generate a dummy Git repo called "cheese" on your Desktop, with 2 branches and 10 commits on each branch:
Original file line number Diff line number Diff line change @@ -35,13 +35,21 @@ def main(
35
35
settings .merge ,
36
36
help = "Comma separated branch ids to merge back into main" ,
37
37
),
38
+ no_subdir : bool = typer .Option (
39
+ settings .no_subdir ,
40
+ help = "Initialize the dummy Git repo in the current directory instead of in a subdirectory" ,
41
+ ),
38
42
):
39
43
settings .name = name
40
- settings .git_dir = os .path .join (os .path .expanduser (git_dir ), name )
41
44
settings .commits = commits
42
45
settings .branches = branches
43
46
settings .diverge_at = diverge_at
44
47
settings .merge = merge
48
+ settings .no_subdir = no_subdir
49
+
50
+ settings .git_dir = os .path .expanduser (git_dir )
51
+ if not settings .no_subdir :
52
+ settings .git_dir = os .path .join (settings .git_dir , settings .name )
45
53
46
54
repo = git .Repo .init (settings .git_dir )
47
55
repo .config_writer ().set_value ("init" , "defaultBranch" , "main" ).release ()
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class Settings(BaseSettings):
9
9
branches = 1
10
10
diverge_at = 0
11
11
merge = ""
12
+ no_subdir = False
12
13
13
14
class Config :
14
15
env_prefix = "git_dummy_"
You can’t perform that action at this time.
0 commit comments