File: get_back_in_sync.sh

package info (click to toggle)
ttyplot 1.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: ansic: 715; python: 97; sh: 32; makefile: 29
file content (33 lines) | stat: -rwxr-xr-x 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env bash
##
## Copyright (c) 2023 by Sebastian Pipping
## Apache License 2.0
##

set -e -u

: ${MAKE:=make}

self_dir="$(dirname "$(type -P "$0")")"

cd "${self_dir}"

if ! git diff --exit-code >/dev/null \
        || ! git diff --cached --exit-code >/dev/null ; then
    echo 'ERROR: Please commit/stash your uncommitted work first, aborting.' >&2
    exit 1
fi

"${MAKE}" -C ..  # to ensure up-to-date ttyplot binary

./record.sh

cp actual.txt expected.txt

git add expected.txt

if git diff --cached --exit-code >/dev/null ; then
    echo 'Already in sync, good.'
else
    EDITOR=true git commit -m 'recordings: Sync expected.txt'
fi