Browse Source

Test and fix --bbl with uncommited changes in a subdirectory

master
Matthieu Moy 11 years ago
parent
commit
cdb6c1b75d
  1. 13
      git-latexdiff
  2. 19
      tests/bib/run-test.sh
  3. 2
      tests/bib/test.bib

13
git-latexdiff

@ -399,6 +399,8 @@ cd "$(git rev-parse --show-cdup)" || die "Can't cd back to repository root"
git_dir=$(cd "$git_dir"; pwd)
main=$git_prefix/$main
mainbase=$(basename "$main" .tex)
maindir=$(dirname "$main")
tmpdir=$tmpdir_prefix/git-latexdiff.$$
mkdir "$tmpdir" || die "Cannot create temporary directory."
@ -413,7 +415,9 @@ verbose "Checking out old and new version"
cd old || die "Cannot cd to old/"
if test "$ln_untracked" = 1; then
ln -s "$initial_dir"/* .
(
mkdir -p "$maindir" && cd "$maindir" && ln -s "$initial_dir"/* .
)
fi
if test "$subtree" = 1; then
@ -427,7 +431,9 @@ fi
verbose_progress
cd ../new || die "Cannot cd to new/"
if test "$ln_untracked" = 1; then
ln -s "$initial_dir"/* .
(
mkdir -p "$maindir" && cd "$maindir" && ln -s "$initial_dir"/* .
)
fi
if test "$new" != "--"; then
# if new == "--" then diff working dir (already there thanks to ln
@ -449,9 +455,6 @@ do
verbose_done
done
mainbase=$(basename "$main" .tex)
maindir=$(dirname "$main")
# Option to use latexdiff --flatten instead of latexpand
if test "$latexdiff_flatten" = 1; then
latexdiffopt+=("--flatten")

19
tests/bib/run-test.sh

@ -2,26 +2,39 @@
die () {
echo "fatal: $@"
cleanup
exit 1
}
cleanup () {
perl -pi -e 's/Uncommited/New/g' test.tex test.bbl
}
trap cleanup 2
perl -pi -e 's/New/Uncommited/g' test.tex test.bbl
oldnew="$(git rev-list HEAD -- test.tex test.bbl)"
old=$(echo "$oldnew" | sed -n '1p')
new=$(echo "$oldnew" | sed -n '2p')
rm -f *.aux *.bbl
echo "git latexdiff without --bbl option (should not display bibliography)"
../../git-latexdiff $old $new 2>&1 > no-bbl.log ||
../../git-latexdiff -v $old $new 2>&1 > no-bbl.log ||
die "latexdiff without --bbl failed (log in no-bbl.log)."
rm -f *.aux *.bbl
echo "git latexdiff with --bbl option (should display diff within bibliography)"
../../git-latexdiff $old $new --bbl 2>&1 > with-bbl.log ||
../../git-latexdiff -v $old $new --bbl 2>&1 > with-bbl.log ||
die "latexdiff with --bbl failed (log in with-bbl.log)."
rm -f *.aux *.bbl
echo "git latexdiff with --latexdiff-flatten option (should not display bibliography)"
../../git-latexdiff $old $new --latexdiff-flatten 2>&1 > with-flatten.log ||
../../git-latexdiff -v $old $new --latexdiff-flatten 2>&1 > with-flatten.log ||
die "latexdiff with --latexdiff-flatten failed (log in flatten.log)."
echo "git latexdiff --bbl against the working directory (should display new -> uncommited changes)"
../../git-latexdiff -v --bbl HEAD -- 2>&1 > workdir.log ||
die "git latexdiff --bbl against the working directory failed (log in workdir.log)."
cleanup

2
tests/bib/test.bib

@ -1,5 +1,5 @@
@Article{test-entry,
author = {New author},
author = {Uncommited author},
title = {Some title},
journal = {Some journal},
year = 42}

Loading…
Cancel
Save