PageRenderTime 80ms CodeModel.GetById 73ms app.highlight 1ms RepoModel.GetById 5ms app.codeStats 0ms

/etckeeper/init.d/70vcs-add

http://github.com/brinkman83/bashrc
Shell | 27 lines | 24 code | 1 blank | 2 comment | 8 complexity | ef0c315d37d73a48ca19c238a57b0b0c MD5 | raw file
 1#!/bin/sh
 2set -e
 3
 4if [ "$VCS" = git ]; then
 5	if ! git add .; then
 6		echo "etckeeper warning: git add failed" >&2
 7	fi
 8elif [ "$VCS" = hg ]; then
 9	if ! hg add .; then
10		echo "etckeeper warning: hg add failed" >&2
11	fi
12elif [ "$VCS" = bzr ]; then
13	if ! bzr add .; then
14		echo "etckeeper warning: bzr add failed" >&2
15	fi
16elif [ "$VCS" = darcs ]; then
17	# Don't warn if all the files were already added.
18	rc=0
19	res=$( darcs add -qr . 2>&1 ) || rc=$?
20	if test $rc -ne 0; then
21		if ! test $rc -eq 2 -a "${res%No files were added}" != "$res"; then
22			printf "%s" "$res"
23			echo "etckeeper warning: darcs add failed" >&2
24		fi
25	fi
26	unset rc res
27fi