buggy smudge/clean of empty files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git seems to be buggy in its handling of empty files when smudge/clean filters
are used.

I've attached a script setup_smudge_clean.sh, which configures a git
repository to use a very simple smudge and clean filter pair for all
files. The clean filter prepends a line "hi" to the file content, and the
smudge filter removes the line. There is nothing very special about this
smudge/clean, it's just a simple one for the sake of an example.

Here's the bug:

# git init repo
# cd repo
# sh ~/setup_smudge_clean.sh
# echo foo > foofile
# git add foofile
# git diff
# touch emptyfile
# git add emptyfile
# git commit -m added
# git status
On branch master
nothing to commit, working tree clean
# git diff
diff --git a/emptyfile b/emptyfile
--- a/emptyfile
+++ b/emptyfile
@@ -1 +0,0 @@
-hi

emptyfile is unchanged, as git status shows, so why is git diff displaying
a change?

It seems that git diff runs the clean filter (GIT_TRACE shows it does),
but it must ignore its output when the file is empty, and always use an empty
file as the current content for the diff. Which differs from what was staged.

-- 
see shy jo

Attachment: setup_smudge_clean.sh
Description: Bourne shell script


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux