Skip to content

CPK fails when there is no git HEAD #18

@mrwalter

Description

@mrwalter
cpk|    INFO : CPK - Code Packaging toolKit - v0.1.1
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Traceback (most recent call last):
  File "/home/ripl/anaconda3/bin/cpk", line 6, in <module>
    run()
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/cli/main.py", line 66, in run
    command.execute(machine, parsed)
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/cli/commands/build.py", line 126, in execute
    project = CPKProject(parsed.workdir, parsed=parsed)
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/project.py", line 46, in __init__
    30: GitRepositoryAdapter(self._path),
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/adapters/git.py", line 13, in __init__
    self._repo = get_repo_info(self._path)
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/utils/git.py", line 16, in get_repo_info
    sha = run_cmd(["git", "--git-dir", f'"{path}"',
  File "/home/ripl/anaconda3/lib/python3.8/site-packages/cpk/utils/misc.py", line 17, in run_cmd
    lines = subprocess.check_output(cmd, shell=True).decode("utf-8").split("\n")
  File "/home/ripl/anaconda3/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/ripl/anaconda3/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'git --git-dir "/home/ripl/code/test-project/.git" rev-parse HEAD' returned non-zero exit status 128.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions