MAJOR=5
MINOR=0
DEVNAME=tty
DEVMODE=0666
  7   ˆl–ßi~”JC]Š�jãlÜm¥1hß�þ\i¹ll´ÊÔ¢ià?É„n>ÏÈÌË ?÷     #!/bin/bash

# Main author: Matthieu Moy <git@matthieu-moy.fr>
# (See the Git history for other contributors)
#
# BSD 2-Clause License
# 
# Copyright (c) 2012 - 2020, Matthieu Moy
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# git-latexdiff is a wrapper around latexdiff
# (http://www.ctan.org/pkg/latexdiff) that allows using it to diff two
# revisions of a LaTeX file.
#
# The script internally checks out the full tree for the specified
# revisions, calls latexpand to flatten the document and then calls
# latexdiff-so (if available, otherwise latexdiff). Therefore,
# this works if the document is split into multiple .tex files.
#
# Try "git latexdiff -h" for more information.
#
# To install, just copy git-latexdiff in your $PATH.

# Missing features (patches welcome ;-):
# - diff the index
# - hardlink temporary checkouts as much as possible

# Alternatives:
#
# There is another script doing essentially the same here:
# https://github.com/cawka/latexdiff/blob/master/latexdiff-git
# My experience is that latexdiff-git is more buggy than
# git-latexdiff, but they probably just don't have the same bugs ;-)
#
# There are a bunch of other alternatives cited here:
#
#   http://tex.stackexchange.com/questions/1325/using-latexdiff-with-git
#
# Ideally, these scripts should be merged.

set -o errexit
set -o pipefail
set -o noclobber
# Used when symlinking files from the working tree: symlink .* files
# too.
shopt -s dotglob

# Some versions of git set $GIT_WORK_TREE when ran through an alias.
# This wouldn't work with git-latexdiff which plays with different
# work trees.
unset GIT_DIR
unset GIT_WORK_TREE

# (Comment and 'unset' line borrowed from Git's source code)
# Having this variable in your environment would break scripts because
# you would cause "cd" to be taken to unexpected places.  If you
# like CDPATH, define it for your interactive shell sessions without
# exporting it.
# But we protect ourselves from such a user mistake nevertheless.
unset CDPATH

# 1.6.0 is substituted by the install script here,
# but not within git_latexdiff_compute_version().
git_latexdiff_version='1.6.0'

git_latexdiff_compute_version () {
    if [ "$git_latexdiff_version" = '@GIT_LATEXDIFF''_VERSION@' ]; then
	(cd "$(dirname "$0")" && git describe --tags HEAD 2>/dev/null || echo 'Unknown version')
    else
	echo "$git_latexdiff_version"
    fi
}

usage () {
    cat << EOF
Usage: $(basename "$0" | sed 's/git-/git /') [options] OLD [NEW]
       $(basename "$0" | sed 's/git-/git /') [options] OLD --
       $(basename "$0" | sed 's/git-/git /') [options] -- OLD
Call latexdiff on two Git revisions of a file.

OLD and NEW are Git revision identifiers. NEW defaults to HEAD.
If "--" is used for NE