On Mon, 16 May 2016 19:56:20 +0300
Konstantin Khomoutov <flatw...@users.sourceforge.net> wrote:
> Something along this lines could be a good start:
> set -e -u
> while read _ our _ their; do
> out=`git diff --name-status --diff-filter=D $their $our`
> test -z "$out" && exit 1
> exit 0
Sorry, the test should be
test -z "$out" || exit 1
of course, that is, exit with code 1 if the string in the variable
"out" is *not* empty -- meaning `git diff` actually found deleted files.
On a side note, please take into account that you (and whoever else
about to use this solution) should be well aware of its implications.
The thing is, Git does not explicitly track renames, and renames are
detected by using a (tunable) heuristics. In unfortunate cases (the
file has been renamed and heavily modified at the same time or the file
was renamed without any modifications at all) those heuristics run by
`git diff` might legitimately fail to detect the rename and the case
will be considered by `git diff` as one file being deleted and another
one added. Obviously, this case will not pass the check in your pre-push
If this problem might apply to your problem, read up on "-M", "-C" and
"--find-copies-harder" command-line options in the `git diff` manual
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.