jjlee / git-meld-index

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

Problem with Git Submodules #4

Closed lprobsth closed 1 year ago

lprobsth commented 1 year ago

When using git-meld-index v0.2.3 in repositories with git submodules the following error is thrown:

Traceback (most recent call last):
  File "/home/lprobsth/.local/bin/git-meld-index", line 8, in <module>
    sys.exit(main())
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 622, in main
    status = _main(sys.argv[0], sys.argv[1:])
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 616, in _main
    work_area.meld(left_view, right_view, tool, arguments.extcmd)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 214, in meld
    right_dir = self._write(right_view)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 195, in _write
    dir_ = view.write(self._env, suggested_dir)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 408, in write
    self.check_out_head(repo_env, path, dest_path)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 373, in check_out_head
    repo_env.cmd(["sh", "-c", shell_cmd])
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 84, in cmd
    return self._env.cmd(args, input, tty)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 145, in cmd
    return self._env.cmd(self._prefix_cmd + args, input, tty)
  File "/home/lprobsth/.local/lib/python3.10/site-packages/git_meld_index.py", line 127, in cmd
    raise CalledProcessError(retcode, args, output, stderr_output)
git_meld_index.CalledProcessError: Command ['sh', '-c', 'cd "$1" && shift && exec "$@"', 'inline_cd', '/home/lprobsth/temp/combine_test/io_core_horizon', 'sh', '-c', 'git cat-file blob fe3ebc6130533fa50c2b209b4afed70f96693fec > /tmp/tmp-git_meld_index-r589hyr0/index/Applications/FRoST_Endeffector'] returned non-zero exit status 128:
stdout:
b''
stderr:
b'fatal: git cat-file fe3ebc6130533fa50c2b209b4afed70f96693fec: bad file\n'

The commit id from the error is only part of one of the submodules. It seems that git-meld-index is using the wrong repository when submodules are present.

jjlee commented 1 year ago

@lprobsth Should be fixed on master now, does that work for you?

You should be able to install it to test it out e.g. using pip install https://github.com/jjlee/git-meld-index/archive/master.zip