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

lint-history example breaks with --filenames-important with a "delete file" commit #51

Closed
thorbenk opened this issue Feb 6, 2020 · 1 comment

Comments

@thorbenk
Copy link

thorbenk commented Feb 6, 2020

Thanks for this project!
I'm trying to use it to rewrite a repo to only use unix lineendings.
However, I'm running into an issue with lint-history together with --filenames-important (note: it does works when omitting --filenames-important).

Here is a minimal repo with which to reproduce this:

rm -rf /tmp/repo_with_delete
mkdir /tmp/repo_with_delete
cd /tmp/repo_with_delete

git init .
echo "A" > a.cpp
git add a.cpp
git commit -am "1"
git rm a.cpp
git commit -am "2"

export PYTHONPATH=/w/src/git-conversion/3rdparty/git-filter-repo/
/w/src/git-conversion/3rdparty/git-filter-repo/contrib/filter-repo-demos/lint-history --filenames-important dos2unix

I get:

dos2unix: converting file /tmp/tmp8vmqz50x/a.cpp to Unix format...
Traceback (most recent call last):
  File "/w/src/git-conversion/3rdparty/git-filter-repo/contrib/filter-repo-demos/lint-history", line 107, in <module>
    filter.run()
  File "/w/src/git-conversion/3rdparty/git-filter-repo/git_filter_repo.py", line 3813, in run
    self._parser.run(self._input, self._output)
  File "/w/src/git-conversion/3rdparty/git-filter-repo/git_filter_repo.py", line 1396, in run
    self._parse_commit()
  File "/w/src/git-conversion/3rdparty/git-filter-repo/git_filter_repo.py", line 1249, in _parse_commit
    self._commit_callback(commit, aux_info)
  File "/w/src/git-conversion/3rdparty/git-filter-repo/git_filter_repo.py", line 3363, in _tweak_commit
    self._commit_callback(commit, self.callback_metadata(aux_info))
  File "/w/src/git-conversion/3rdparty/git-filter-repo/contrib/filter-repo-demos/lint-history", line 64, in lint_with_real_filenames
    cat_file_process.stdin.write(change.blob_id + b'\n')
TypeError: unsupported operand type(s) for +: 'NoneType' and 'bytes'
fatal: stream ends early
fast-import: dumping crash report to .git/fast_import_crash_22223

I'm on commit 4ea19c0 of git-filter-repo.

@newren
Copy link
Owner

newren commented Feb 6, 2020

Thanks for the report! This commit that I just pushed fixes this:

commit 9d3d99593c88e0e0f6799c3bc83fa4a9c8f5cb01
Author: Elijah Newren <newren@gmail.com>
Date:   Thu Feb 6 13:00:48 2020 -0800

    lint-history: avoid dying when we get file deletions
    
    When a file is deleted, there is nothing to lint, so we can just keep
    the deletion as-is.
    
    Reported-by: Thorben Kröger <dev@thorben.net>
    Signed-off-by: Elijah Newren <newren@gmail.com>

@newren newren closed this as completed Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants