]> juplo.de Git - demos/kafka/training/commitdiff
copy.sh: Ausgabe bereinigt — nur tatsächliche Änderungen sichtbar
authorKai Moritz <kai.milan.moritz@googlemail.com>
Sun, 31 May 2026 19:21:42 +0000 (19:21 +0000)
committerKai Moritz <kai.milan.moritz@googlemail.com>
Sun, 31 May 2026 19:21:42 +0000 (19:21 +0000)
Statt rsync -av (alle Dateien) jetzt --itemize-changes mit Filter:
Ausgabe zeigt nur neue/geänderte Dateien (>f, cd) und Löschungen (*deleting).
Vor jedem Branch-Sync wird ein Header angezeigt (branch → ziel/pfad),
sodass klar ist, was gerade verarbeitet wird.

Weitere Bereinigungen:
- git checkout/reset/fetch mit -q: keine "Switched to branch"- und
  "HEAD is now at"-Ausgaben mehr (lib.sh, copy.sh)
- "Ignoriere Einzelschritte" → "Überspringe <branch>" (kürzer)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
copy.sh
lib.sh

diff --git a/copy.sh b/copy.sh
index 3c44a9543ef259960a23b8cfc8a06746392d33e5..e3263c1bdfba62b05f6ef3308f05fabf06e53e6d 100755 (executable)
--- a/copy.sh
+++ b/copy.sh
@@ -33,7 +33,7 @@ while [ $# -gt 0 ]; do
 done
 
 RSYNC_OPTS=(
-  rsync -av
+  rsync -a
   --delete
   --exclude=.git
   --exclude=target
@@ -51,16 +51,27 @@ RSYNC_OPTS=(
 )
 
 checkout_branch() {
-  if [ "$TAG_SUFFIX" != "" ]; then
-    git checkout "${1}--${TAG_SUFFIX}"
+  if [ -n "$TAG_SUFFIX" ]; then
+    git checkout -q "${1}--${TAG_SUFFIX}"
   else
-    git checkout "$1"
+    git checkout -q "$1"
   fi
 }
 
 sync_to() {
-  mkdir -p "$1"
-  "${RSYNC_OPTS[@]}" . "$1"
+  local dest="$1" rsync_out
+  rsync_out=$(mktemp)
+  mkdir -p "$dest"
+  "${RSYNC_OPTS[@]}" --itemize-changes . "$dest" > "$rsync_out"
+  grep -E '^[>c*]' "$rsync_out" || true
+  rm -f "$rsync_out"
+}
+
+sync_header() {
+  local branch="$1" dest="$2"
+  local src="${TAG_SUFFIX:+${branch}--${TAG_SUFFIX}}"
+  src="${src:-${branch}}"
+  echo -e "\n${src} → ${dest#../training-exercises/}"
 }
 
 if [ "$TAG_SUFFIX" = "" ] && ! $LOCAL; then
@@ -76,14 +87,15 @@ if [ "$TAG_SUFFIX" = "" ] && ! $LOCAL; then
   fi
   echo "Einheitliche Tags vorhanden: $(echo "$_common_suffixes" | tr '\n' ' ')"
 
-  echo "Aktualisiere alle Branches auf Remote-Stand..."
-  git fetch origin
+  echo -e "\nAktualisiere alle Branches auf Remote-Stand..."
+  git fetch origin -q
   reset_branches_to_remote
 fi
 
 EXPECTED=$(mktemp)
 trap 'rm -f "$EXPECTED"' EXIT
 
+sync_header "grundlagen/docker" "$VORLAGEN/grundlagen/docker"
 checkout_branch "grundlagen/docker"
 echo "$VORLAGEN/grundlagen/docker" >> "$EXPECTED"
 sync_to "$VORLAGEN/grundlagen/docker/"
@@ -92,7 +104,7 @@ for i in $BRANCHES; do
   declare -n branch=${i}
   case "$branch" in
   *--livecoding--schritte)
-    echo "Ignoriere Einzelschritte eines Live-Codings: $branch"
+    echo -e "\nÜberspringe $branch"
     continue
     ;;
   *--vorlage)
@@ -105,6 +117,7 @@ for i in $BRANCHES; do
     dest="$MUSTERLOESUNGEN/$branch"
     ;;
   esac
+  sync_header "$branch" "$dest"
   checkout_branch "$branch"
   echo "$dest" >> "$EXPECTED"
   sync_to "$dest/"
@@ -121,4 +134,4 @@ for base in "$VORLAGEN" "$LIVECODING" "$MUSTERLOESUNGEN"; do
   done < <(find "$base" -mindepth 2 -maxdepth 2 -type d | sort)
 done
 
-git checkout scripting
+git checkout -q scripting
diff --git a/lib.sh b/lib.sh
index 638efa399858eae3cbfca757b0b073eff23ed064..c540626cb36072424aadd5acbf5fe1d1af7bb896 100755 (executable)
--- a/lib.sh
+++ b/lib.sh
@@ -39,9 +39,9 @@ find_common_tag_suffixes() {
 reset_branches_to_remote() {
   local branch
   for branch in "${BRANCH_NAMES[@]}"; do
-    echo -e "\nResetting $branch to origin/$branch"
-    git checkout "$branch"
-    git reset --hard "origin/$branch"
+    echo "  $branch"
+    git checkout -q "$branch"
+    git reset -q --hard "origin/$branch"
   done
-  git checkout scripting
+  git checkout -q scripting
 }