Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nbgitpuller fails to reset deleted files #121

Closed
stv0g opened this issue Apr 27, 2020 · 2 comments · Fixed by #156
Closed

Nbgitpuller fails to reset deleted files #121

stv0g opened this issue Apr 27, 2020 · 2 comments · Fixed by #156
Labels

Comments

@stv0g
Copy link

stv0g commented Apr 27, 2020

Bug description

Nbgitpuller fails to restore a deleted file by the user.

This error might be caused be the special unicode characters in the filename.
Or this might be just a coincidence

Expected behaviour

Nbgitpuller should restore the deleted files without raising an exception.

Actual behaviour

image

How to reproduce

  1. Pull a repo via gitpuller
  2. Delete a file with sepcial characters
  3. Pull again

Your personal set up

  • OS: MacOS, Chrome
  • Version:
  • Configuration: JupyterHub + Kubespawner, Execution of gitpuller via lifecyle hook
@manics manics added the bug label Oct 3, 2020
@manics
Copy link
Member

manics commented Oct 3, 2020

Reproduced today with current master (5481b59)

git init src
cd src
touch unicode🙂.txt
git add unicode🙂.txt
git commit -m 'add unicode'
cd ..
gitpuller file:///src master dest
rm dest/unicode🙂.txt
gitpuller file:///src master dest

output:

$ git fetch

$ git checkout origin/master -- "unicode\360\237\231\202.txt"

error: pathspec '"unicode\360\237\231\202.txt"' did not match any file(s) known to git

Traceback (most recent call last):
  File "/usr/local/bin/gitpuller", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/nbgitpuller/pull.py", line 250, in main
    for line in GitPuller(
  File "/usr/local/lib/python3.8/site-packages/nbgitpuller/pull.py", line 86, in pull
    yield from self.update()
  File "/usr/local/lib/python3.8/site-packages/nbgitpuller/pull.py", line 203, in update
    yield from self.reset_deleted_files()
  File "/usr/local/lib/python3.8/site-packages/nbgitpuller/pull.py", line 115, in reset_deleted_files
    yield from execute_cmd(['git', 'checkout', 'origin/{}'.format(self.branch_name), '--', filename], cwd=self.repo_dir)
  File "/usr/local/lib/python3.8/site-packages/nbgitpuller/pull.py", line 45, in execute_cmd
    raise subprocess.CalledProcessError(ret, cmd)
subprocess.CalledProcessError: Command '['git', 'checkout', 'origin/master', '--', '"unicode\\360\\237\\231\\202.txt"']' returned non-zero exit status 1.

Works fine with a non-unicode filename.

@consideRatio
Copy link
Member

@stv0g @manics :hear: 🎉 thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants