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

Fix failure to restore deleted files (use raw output of git ls-files to avoid quoting unicode) #156

Merged
merged 2 commits into from
Oct 3, 2020

Conversation

manics
Copy link
Member

@manics manics commented Oct 3, 2020

Closes #121

git ls-files defaults to using octal escapes for non-ascii characters. Passing -z disables this.

@manics manics changed the title Issue 121 Use raw output of git ls-files to avoid quoting unicode Oct 3, 2020
'git', 'ls-files', '--deleted'
], cwd=self.repo_dir).decode().strip().split('\n')
'git', 'ls-files', '--deleted', '-z'
], cwd=self.repo_dir).decode().strip().split('\0')
Copy link
Member

@consideRatio consideRatio Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this LGTM, I wondered about the \0 split first.

       -z
           \0 line termination on output and do not quote filenames. See OUTPUT below for more information.

       ...

       Without the -z option, pathnames with "unusual" characters are quoted as explained for the configuration variable core.quotePath (see git-config(1)).
       Using -z the filename is output verbatim and the line is terminated by a NUL byte.

@consideRatio
Copy link
Member

consideRatio commented Oct 3, 2020

@manics excellent that you also added a test, this looks great to me! Since this fixes a know bug, and has a test, and LGTM, I'll go ahead and merge this right away.

@consideRatio consideRatio merged commit d85b270 into jupyterhub:master Oct 3, 2020
@manics manics deleted the issue-121 branch October 3, 2020 20:42
@consideRatio consideRatio changed the title Use raw output of git ls-files to avoid quoting unicode Fix failure to restore deleted files (use raw output of git ls-files to avoid quoting unicode) Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nbgitpuller fails to reset deleted files
2 participants