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

Only use 'antiword' in 'astextplain' if 'file' identified a Word document #432

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

Vampire
Copy link
Contributor

@Vampire Vampire commented Aug 15, 2022

Without this change you always get output that a given file is not a Word document, for example during pickaxeing.

@Vampire Vampire changed the title Only use 'antiword' in 'astextplain' if 'file' identified a Word documentment Only use 'antiword' in 'astextplain' if 'file' identified a Word document Aug 15, 2022
…ment

Without this change you always get output that a given file is not a
Word document, for example during pickaxeing.

Signed-off-by: Björn Kautler <[email protected]>
@@ -12,7 +12,14 @@ case "$1" in
odt2txt "$1" || cat "$1"
;;
*.doc | *.DOC | *.dot | *.DOT)
out=$(antiword -m UTF-8 "$1") && sed "s/\^M$//" <<<$out || cat "$1"
case "$(file --brief --mime-type "$1")" in
Copy link
Member

Choose a reason for hiding this comment

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

My first reaction was to be concerned about the time spent on spawning file, but file has hard enough of a time to identify all the Word Document flavors that the alternative (namely, to hand-roll a script to identify Word Documents) seems prohibitive.

My next reaction was to be concerned about MinGit, but then I looked and found out that MinGit does not ship with astextplain (nor with file, for that matter).

@dscho dscho merged commit c819dab into git-for-windows:main Aug 15, 2022
dscho added a commit that referenced this pull request Aug 15, 2022
Git for Windows [now correctly handles `.doc` files that are not Word
Documents](#432).

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member

dscho commented Aug 15, 2022

@Vampire thank you for your contribution!

@MayraPeralesContrera

This comment was marked as spam.

svraka added a commit to svraka/dotfiles that referenced this pull request Mar 5, 2024
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

Successfully merging this pull request may close these issues.

3 participants