chiark / gitweb /
Save all commit updates in an array, loop over them later
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 6 Sep 2013 21:36:10 +0000 (23:36 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 6 Sep 2013 21:36:10 +0000 (23:36 +0200)
commitupdates

index 69c24b389617dd49977725ec6cc9f5e579149e7d..bde57e23f31db1f83488fac35908e24181bd2d83 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+commands=()
+
 while read line; do
     if [[ "$line" == *M*metadata/*.txt ]]; then
         file=${line##* }
@@ -25,9 +27,12 @@ while read line; do
         id=${id%.txt*}
         [ -d metadata/$id ] && extra=metadata/$id
         [ -n "$name" ] && id="$name ($id)"
+
+        commands+=("git commit -m 'Update $id to $version ($vercode)' -e -- $file $extra")
     fi
 done < <(git status --porcelain)
 
-echo "> git commit -m \"Update $id to $version ($vercode)\" -e -- $file $extra"
-git commit -m "Update $id to $version ($vercode)" -e -- $file $extra
+for cmd in "${commands[@]}"; do
+    eval "$cmd"
+done