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:
6565` --diverge-at ` : The commit number at which branches diverge from ` main ` .
6666` --merge ` : A comma separated list of branch postfix ids to merge back into ` main ` .
6767` --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.
6869
6970## Command examples
7071Generate 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(
3535 settings .merge ,
3636 help = "Comma separated branch ids to merge back into main" ,
3737 ),
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+ ),
3842):
3943 settings .name = name
40- settings .git_dir = os .path .join (os .path .expanduser (git_dir ), name )
4144 settings .commits = commits
4245 settings .branches = branches
4346 settings .diverge_at = diverge_at
4447 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 )
4553
4654 repo = git .Repo .init (settings .git_dir )
4755 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):
99 branches = 1
1010 diverge_at = 0
1111 merge = ""
12+ no_subdir = False
1213
1314 class Config :
1415 env_prefix = "git_dummy_"
You can’t perform that action at this time.
0 commit comments