Formatting.
[parsecvs/imz-RCS2git-use-cases.git] / parsecvs-as-sidehist
blobc8bd65ee3ce350553d2d1772d29af196853cce5b
1 #!/bin/bash
3 set -e
5 usage() {
6 printf $"Usage: %s REMOTENAME ... , where ... stands for parsecvs args.\n" "$0"
9 if [[ $# < 1 ]]; then
10 usage
11 exit 1
14 readonly REMOTE="$1"
15 shift
17 readonly WORK_DIR="$(mktemp -d --tmpdir parsecvs-"$(basename "$REMOTE")".XXXXXX)"
18 # -- basename is needed to make / possible in the branchnames.
19 # I'll remove the temp dir only if the script completes successfully;
20 # otherwise, let it stay for investigation.
21 failed() {
22 printf $"%s failed; investigate in %s.\n" "$0" "$WORK_DIR"
24 trap failed ERR
26 GIT_DIR="$WORK_DIR"/.git parsecvs "$@"
28 git fetch "$WORK_DIR" refs/heads/*:"$REMOTE"/*
30 echo $"Cleaning up:"
31 rm -rf "$WORK_DIR" && printf $"%s removed.\n" "$WORK_DIR"