TT#11776 Support git v2.9.3 and newer

When installing Debian/stretch we fail at this stage:

| ngcpcfg --no-db-sync commit

On first glance it looks like a mariadb issue, though actually
it's the git status check inside ngcpcfg that's failing.  The
reason is that starting with git v2.9.3 there's a different
output in its "status" output:

| commit 2a0e6cdedab306eccbd297c051035c13d0266343
| Author: Lars Vogel <lars.vogel@gmail.com>
| Date:   Thu Jun 9 20:19:30 2016 +0200
|
|     Use "working tree" instead of "working directory" for git status
|
|     Working directory can be easily confused with the current directory.
|     In one of my patches I already updated the usage of working directory
|     with working tree for the man page but I noticed that git status also
|     uses this incorrect term.
|
|     Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
|     Signed-off-by: Junio C Hamano <gitster@pobox.com>

In Debian/stretch we've 2.11.0-2 and are affected by this change.
Adjust the `git status` checks accordingly to support git in all
its versions.

NOTE: we should consider switching to `git status --porcelain`
(see git commit fc5af3bbb2 for
some history about it) once we've the testsuite in place.

Change-Id: If4223a35083d279e746dce5a80bcb86b52f64025
changes/50/11650/1
Michael Prokop 8 years ago
parent 2abadfe9fd
commit bd9bf75e4a

@ -24,8 +24,8 @@ check_for_outstanding_commits() {
log_debug "cd $NGCPCTL_MAIN"
cd "$NGCPCTL_MAIN"
log_debug "git status | grep -q 'working directory clean'"
if git status | grep -q 'working directory clean' ; then
log_debug "git status | grep -qE 'working (directory|tree) clean'"
if git status | grep -qE 'working (directory|tree) clean' ; then
return 1 # nothing to commit
else
return 0 # outstanding commits

@ -64,7 +64,7 @@ if ! $MODIFIED_ONLY ; then
else
log_info "Considering modified files only due to --modified-only option."
if git status | grep -q 'working directory clean' ; then
if git status | grep -qE 'working (directory|tree) clean' ; then
log_info "No changes found, nothing to do."
exit 0
fi

@ -67,8 +67,8 @@ else
msg="$*"
fi
log_debug "git status | grep -q 'working directory clean'"
if git status | grep -q 'working directory clean' ; then
log_debug "git status | grep -qE 'working (directory|tree) clean'"
if git status | grep -qE 'working (directory|tree) clean' ; then
log_info "OK: nothing to commit."
else
log_debug "git add . ; git commit -a -m \"\$msg [\$(date --rfc-3339=ns)]\""

@ -36,7 +36,7 @@ fi
log_info "Checking state of /etc files"
log_debug 'git status | grep -q "working directory clean"'
if git status | grep -q 'working directory clean' ; then
if git status | grep -qE 'working (directory|tree) clean' ; then
log_info "OK: nothing to commit."
else
log_debug "etckeeper commit \"ngcpcfg apply on \$(date)\""

@ -53,7 +53,7 @@ fi
log_debug "git add ."
git add .
if ! git status | grep -q 'working directory clean' ; then
if ! git status | grep -qE 'working (directory|tree) clean' ; then
log_debug "git commit -a -m \"initial version of ngcpcfg on $HNAME\""
git commit -a -m "initial version of ngcpcfg on $HNAME" >/dev/null
fi

@ -60,8 +60,8 @@ check_local_state() {
log_info "OK: has been initialised already"
log_info "Checking state of configuration files:"
log_debug "git status | grep -q 'working directory clean'"
if git status | grep -q 'working directory clean' ; then
log_debug "git status | grep -qE 'working (directory|tree) clean"
if git status | grep -qE 'working (directory|tree) clean' ; then
log_info "OK: nothing to commit"
else
if git diff-index --name-only HEAD | grep -q . ; then
@ -87,8 +87,8 @@ check_etc_state() {
cd /etc
log_info "Checking state of /etc files:"
log_debug "git status | grep -q 'working directory clean'"
if git status | grep -q 'working directory clean' ; then
log_debug "git status | grep -qE 'working (directory|tree) clean'"
if git status | grep -qE 'working (directory|tree) clean' ; then
log_info "OK: nothing to commit"
else
log_info "ACTION_NEEDED: configuration files changed (execute 'etckeeper commit [message]')"

Loading…
Cancel
Save