bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
{ $(RM) "$$execdir/git-add$X" && \
- ln git-add$X "$$execdir/git-add$X" 2>/dev/null || \
- cp git-add$X "$$execdir/git-add$X"; } && \
+ ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \
+ cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \
{ for p in $(filter-out git-add$X,$(BUILT_INS)); do \
$(RM) "$$execdir/$$p" && \
ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \
check-builtins::
./check-builtins.sh
+ ### Test suite coverage testing
+ #
+ .PHONY: coverage coverage-clean coverage-build coverage-report
+
+ coverage:
+ $(MAKE) coverage-build
+ $(MAKE) coverage-report
+
+ coverage-clean:
+ rm -f *.gcda *.gcno
+
+ COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
+ COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
+
+ coverage-build: coverage-clean
+ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
+ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
+ -j1 test
+
+ coverage-report:
+ gcov -b *.c
+ grep '^function.*called 0 ' *.c.gcov \
+ | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
+ | tee coverage-untested-functions
for i in 1 2; do echo $i; done >>dir/sub &&
git update-index file0 dir/sub &&
+ mkdir dir3 &&
+ cp dir/sub dir3/sub &&
+ test-chmtime +1 dir3/sub &&
+
git config log.showroot false &&
git commit --amend &&
git show-branch
log --root --cc --patch-with-stat --summary master
log -SF master
log -SF -p master
+ log --decorate --all
+
+ rev-list --parents HEAD
+ rev-list --children HEAD
whatchanged master
whatchanged -p master
diff --name-status dir2 dir
diff --no-index --name-status dir2 dir
diff --no-index --name-status -- dir2 dir
+diff --no-index dir dir3
diff master master^ side
+ diff --dirstat master~1 master~2
EOF
test_done
'
+printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
+test_expect_success 'pretty' '
+
+ git log --pretty="format:%s" > actual &&
+ test_cmp expect actual
+'
+
+printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
+test_expect_success 'pretty (tformat)' '
+
+ git log --pretty="tformat:%s" > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'pretty (shortcut)' '
+
+ git log --pretty="%s" > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format' '
+
+ git log --format="%s" > actual &&
+ test_cmp expect actual
+'
+
+cat > expect << EOF
+804a787 sixth
+394ef78 fifth
+5d31159 fourth
+2fbe8c0 third
+f7dab8e second
+3a2fdcb initial
+EOF
+test_expect_success 'oneline' '
+
+ git log --oneline > actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'diff-filter=A' '
actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
test_cmp expect actual
'
+ cat > expect <<EOF
+ * Second
+ * sixth
+ * fifth
+ * fourth
+ * third
+ * second
+ * initial
+ EOF
+
+ test_expect_success 'simple log --graph' '
+ git log --graph --pretty=tformat:%s >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success 'set up merge history' '
+ git checkout -b side HEAD~4 &&
+ test_commit side-1 1 1 &&
+ test_commit side-2 2 2 &&
+ git checkout master &&
+ git merge side
+ '
+
+ cat > expect <<\EOF
+ * Merge branch 'side'
+ |\
+ | * side-2
+ | * side-1
+ * | Second
+ * | sixth
+ * | fifth
+ * | fourth
+ |/
+ * third
+ * second
+ * initial
+ EOF
+
+ test_expect_success 'log --graph with merge' '
+ git log --graph --date-order --pretty=tformat:%s |
+ sed "s/ *$//" >actual &&
+ test_cmp expect actual
+ '
+
+ cat > expect <<\EOF
+ * commit master
+ |\ Merge: A B
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | Merge branch 'side'
+ | |
+ | * commit side
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | side-2
+ | |
+ | * commit tags/side-1
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | side-1
+ | |
+ * | commit master~1
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | Second
+ | |
+ * | commit master~2
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | sixth
+ | |
+ * | commit master~3
+ | | Author: A U Thor <author@example.com>
+ | |
+ | | fifth
+ | |
+ * | commit master~4
+ |/ Author: A U Thor <author@example.com>
+ |
+ | fourth
+ |
+ * commit tags/side-1~1
+ | Author: A U Thor <author@example.com>
+ |
+ | third
+ |
+ * commit tags/side-1~2
+ | Author: A U Thor <author@example.com>
+ |
+ | second
+ |
+ * commit tags/side-1~3
+ Author: A U Thor <author@example.com>
+
+ initial
+ EOF
+
+ test_expect_success 'log --graph with full output' '
+ git log --graph --date-order --pretty=short |
+ git name-rev --name-only --stdin |
+ sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success 'set up more tangled history' '
+ git checkout -b tangle HEAD~6 &&
+ test_commit tangle-a tangle-a a &&
+ git merge master~3 &&
+ git merge side~1 &&
+ git checkout master &&
+ git merge tangle
+ '
+
+ cat > expect <<\EOF
+ * Merge branch 'tangle'
+ |\
+ | * Merge branch 'side' (early part) into tangle
+ | |\
+ | * \ Merge branch 'master' (early part) into tangle
+ | |\ \
+ | * | | tangle-a
+ * | | | Merge branch 'side'
+ |\ \ \ \
+ | * | | | side-2
+ | | | |/
+ | | |/|
+ | |/| |
+ | * | | side-1
+ * | | | Second
+ * | | | sixth
+ | | |/
+ | |/|
+ |/| |
+ * | | fifth
+ * | | fourth
+ |/ /
+ * | third
+ |/
+ * second
+ * initial
+ EOF
+
+ test_expect_success 'log --graph with merge' '
+ git log --graph --date-order --pretty=tformat:%s |
+ sed "s/ *$//" >actual &&
+ test_cmp expect actual
+ '
+
test_done