jjlee / git-meld-index

Run meld or any git difftool to interactively stage changes
Other
75 stars 4 forks source link

returned non-zero exit status 1: 'cp: -r not specified; omitting directory #5

Closed joes closed 2 days ago

joes commented 1 year ago

I tried to execute meld-index on a git repository:

git meld-index

Got the following error:

Traceback (most recent call last):
  File "/home/user/.local/bin/git-meld-index", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 619, in main
    status = _main(sys.argv[0], sys.argv[1:])
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 613, in _main
    work_area.meld(left_view, right_view, tool, arguments.extcmd)
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 205, in meld
    left_dir = self._write(left_view)
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 187, in _write
    dir_ = view.write(self._env, suggested_dir)
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 306, in write
    dest_env.cmd([
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 113, in cmd
    return self._env.cmd(args, input, tty)
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 137, in cmd
    return self._env.cmd(self._prefix_cmd + args, input, tty)
  File "/home/user/.local/lib/python3.9/site-packages/git_meld_index.py", line 87, in cmd
    raise CalledProcessError(retcode, args, output, stderr_output)
git_meld_index.CalledProcessError: Command ['sh', '-c', 'cd "$1" && shift && exec "$@"', 'inline_cd', '/tmp/tmp-git_meld_index-2xkgx23o/working_tree', 'cp', '-Pp', '/home/user/Projects/api-cluster-init/docker_devbox/environments/test-kristinehamn-api-cluster-dev/', 'docker_devbox/environments/test-kristinehamn-api-cluster-dev/'] returned non-zero exit status 1:
stdout:
b''
stderr:
b"cp: -r not specified; omitting directory '/home/user/Projects/api-cluster-init/docker_devbox/environments/test-kristinehamn-api-cluster-dev/'\n"

The git status for that directory is that it is a new directory not added yet:

$ git status -s docker_devbox/
?? docker_devbox/

A peek inside the directory docker_devbox:

$ tree -L 3 docker_devbox
docker_devbox
└── environments
    └── test-kristinehamn-api-cluster-dev
        ├── README.md
        ├── ansible.cfg
        ├── ansible_plugins
        ├── bin
        └── lock
jjlee commented 1 year ago

Hi, thanks for the report

Just running locally here with similar directory structures and this version of git, I can't reproduce:

$ git --version
git version 2.41.0

Could you let me know what version of git you're using?

What happens when you're able to reproduce the bug and you run this in the top level of the git repo?

git ls-files --others --exclude-standard

Ideally, if you can reproduce it by making a tiny directory with a few directories / files, running git init then git meld, that would be great too. If so please tar or zip it up and attach it to this issue.

joes commented 1 year ago
$ git --version
git version 2.35.1

What version of python is recommended?

I had issues with version 3.8 so I upgraded to python 3.9. But, it seems that upgrading the system's python version caused other issues with python so I am not able to reproduce anything right now.

jjlee commented 1 year ago

Thanks

Python 3.9 should be fine, and python is unlikely to be the problem if git meld-index runs at all (I see 3.8 lacks str.removesuffix). I'm curious which OS and version you're using that has 3.8 as the system installed python (if it's a popular OS release I may make it work with that system python version)?

You can use https://github.com/pyenv/pyenv to install another python version to avoid the risk of breaking your system by upgrading python.

I can't reproduce with git 2.35.1, so a zip that reproduces the issue for you would be useful, as would the output of the git command above.

jjlee commented 2 days ago

Closing because can't reproduce