Skip to content

Error with the branch creation in the dummy repo #2

@deliaBlue

Description

@deliaBlue

Hey! After installing git-dummy and trying to create a dummy repo with the command

$ git-dummy --commits=10 --branches=4 --merge=1

I got the following error:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/****/mambaforge/envs/bioconda/lib/python3.8/site-packages/git_dummy/__main__.py:134 in main                                                   
│                                                                              
│   131 │   │   repo.git.checkout("main")                                      
│   132 │                                                                      
│   133 │   except Exception as e:                                             
│ ❱ 134 │   │   raise e                                                        
│   135 │                                                                      
│   136 │   finally:                                                           
│   137 │   │   # If needed, delete the environment variables set by git-dummy 
│                                                                              
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ 
│ │      branches = 4                                                      
│ │             c = 10                                                   
│ │       commits = 10                                                      
│ │ config_writer = <git.config.GitConfigParser object at 0x7f5f35b2fd90>   
│ │  constant_sha = False                                                   
│ │    diverge_at = 0                                                      
│ │       git_dir = PosixPath('/home/****/Desktop')                   
│ │         merge = '1'                                                
│ │          name = 'dummy'                                            
│ │     no_subdir = False                                               
│ │          repo = <git.repo.base.Repo                                  
│ │                 '/home/****/Desktop/dummy/.git'>                  
│ ╰──────────────────────────────────────────────────────────────────────────╯ 
│                                                                              
│ /home/****/mambaforge/envs/bioconda/lib/python3.8/site-packages/git_dummy/__main__.py:101 in main                                                   │
│                                                                              
│    98 │   │   │   repo.index.commit(f"Dummy commit #{c} on main")            
│    99 │   │                                                                  
│   100 │   │   while settings.branches - 1 > 0:                               
│ ❱ 101 │   │   │   repo.git.checkout("main")                                  
│   102 │   │   │   r = (                                                      
│   103 │   │   │   │   (settings.commits - settings.diverge_at)               
│   104 │   │   │   │   if settings.diverge_at                                 
│                                                                              
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ 
│ │      branches = 4                                                      
│ │             c = 10                                                      
│ │       commits = 10                                                    
│ │ config_writer = <git.config.GitConfigParser object at 0x7f5f35b2fd90>    
│ │  constant_sha = False                                                   
│ │    diverge_at = 0                                                        
│ │       git_dir = PosixPath('/home/****/Desktop')                     
│ │         merge = '1'                                                      
│ │          name = 'dummy'                                                  
│ │     no_subdir = False                                                    
│ │          repo = <git.repo.base.Repo                                      
│ │                 '/home/*****/Desktop/dummy/.git'>                    
│ ╰──────────────────────────────────────────────────────────────────────────╯ 
│                                                                              
│ /home/*****/mambaforge/envs/bioconda/lib/python3.8/site-packages/git/cmd .py:542 in <lambda>                                                          
│                                                                              
│    539 │   │   :return: Callable object that will execute call _call_process
│    540 │   │   if name[0] == '_':                                            
│    541 │   │   │   return LazyMixin.__getattr__(self, name)                  
│ ❱  542 │   │   return lambda *args, **kwargs: self._call_process(name, *args 
│    543 │                                                                     
│    544 │   def set_persistent_git_options(self, **kwargs):                   
│    545 │   │   """Specify command line options to the git executable         
│                                                                              
│ ╭──────────────────── locals ─────────────────────╮                          
│ │   args = ('main',)                              
│ │ kwargs = {}                                     
│ │   name = 'checkout'                             
│ │   self = <git.cmd.Git object at 0x7f5f35b2b6a0>
│ ╰─────────────────────────────────────────────────╯                          
│                                                                              
│ /home/****/mambaforge/envs/bioconda/lib/python3.8/site-packages/git/cmd.py:1005 in _call_process                                                    │
│                                                                             
│   1002 │   │   call.append(dashify(method))                                  
│   1003 │   │   call.extend(args)                                            
│   1004 │   │                                                                
│ ❱ 1005 │   │   return self.execute(call, **exec_kwargs)                    
│   1006 │                                                                    
│   1007 │   def _parse_object_header(self, header_line):                    
│   1008 │   │   """                                                           
│                                                                              
│ ╭──────────────────────────── locals ────────────────────────────╮  
│ │                  args = ['main']                           
│ │                  call = ['git', 'checkout', 'main']         
│ │           exec_kwargs = {}                                    
│ │              ext_args = ['main']                              
│ │ insert_after_this_arg = None                                  
│ │                kwargs = {}                                    
│ │                method = 'checkout'                            
│ │              opt_args = []                                     
│ │           opts_kwargs = {}                                     
│ │                  self = <git.cmd.Git object at 0x7f5f35b2b6a0> 
│ ╰────────────────────────────────────────────────────────────────╯           
│                                                                              
│ /home/*****/mambaforge/envs/bioconda/lib/python3.8/site-packages/git/cmd.py:822 in execute                                                           
│                                                                              
│    819 │   │   # END handle debug printing                                   
│    820 │   │                                                                 
│    821 │   │   if with_exceptions and status != 0:                           
│ ❱  822 │   │   │   raise GitCommandError(command, status, stderr_value, stdo 
│    823 │   │                                                                 
│    824 │   │   if isinstance(stdout_value, bytes) and stdout_as_string:  # c 
│    825 │   │   │   stdout_value = safe_decode(stdout_value)                 
│                                                                              
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ 
│ │           _kill_process = <function Git.execute.<locals>._kill_process  
│ │                           at 0x7f5f351183a0>                           
│ │              as_process = False                                          
│ │ cmd_not_found_exception = <class 'FileNotFoundError'>                   
│ │                 command = ['git', 'checkout', 'main']                   
│ │                     cwd = '/home/****/Desktop/dummy'                
│ │                     env = {                                              
│ │                           │   'SHELL': '/bin/bash',                      
│ │                           │   'SESSION_MANAGER':                         
│ │                           'local/****:@/tmp/.ICE-unix/2288,unix/****:… 
│ │                           │   'QT_ACCESSIBILITY': '1',                  
│ │                           │   'COLORTERM': 'truecolor',                  
│ │                           │   'XDG_CONFIG_DIRS':                         
│ │                           '/etc/xdg/xdg-ubuntu:/etc/xdg',               
│ │                           │   'SSH_AGENT_LAUNCHER': 'gnome-keyring',    
│ │                           │   'XDG_MENU_PREFIX': 'gnome-',              
│ │                           │   'GNOME_DESKTOP_SESSION_ID':                
│ │                           'this-is-deprecated',                          
│ │                           │   'CONDA_EXE':                               
│ │                           '/home/*****/mambaforge/bin/conda',        
│ │                           │   '_CE_M': '',                              
│ │                           │   ... +65                                   
│ │                           }                                              
│ │              inline_env = None                                           
│ │                 istream = None                                           
│ │              istream_ok = 'None'                                         
│ │      kill_after_timeout = None                                           
│ │          max_chunk_size = 8192                                           
│ │           output_stream = None                                           
│ │                    proc = <subprocess.Popen object at 0x7f5f3511d6a0>    
│ │                    self = <git.cmd.Git object at 0x7f5f35b2b6a0>         
│ │                   shell = None                                           
│ │                  status = 1                                              
│ │            stderr_value = b"error: pathspec 'main' did not match any    
│ │                           file(s) known to git"                          
│ │        stdout_as_string = True                                           
│ │             stdout_sink = -1                                             
│ │            stdout_value = b''                                            
│ │       subprocess_kwargs = {}                                            
│ │      universal_newlines = False                                          
│ │         with_exceptions = True                                           
│ │    with_extended_output = False                                          
│ │             with_stdout = True                                           
│ ╰──────────────────────────────────────────────────────────────────────────╯
╰──────────────────────────────────────────────────────────────────────────────╯
GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git checkout main
  stderr: 'error: pathspec 'main' did not match any file(s) known to git'

After checking the dummy repo, all the commits are there but the only branch is the main.

The git-dummy version is 0.0.9 with a python version is 3.8.17 running in Ubuntu 22.04.2.

During the installation, these other dependencies were installed:

annotated-types-0.5.0 
pydantic-2.0 
pydantic-core-2.0.1 
typer-0.9.0

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions