]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: supress error messages from git
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 Sep 2024 13:58:32 +0000 (15:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 Sep 2024 14:45:44 +0000 (16:45 +0200)
When updating, I get a message like:
fatal: Not a valid object name a67221c3f0d0b81b9b5b3230a71d09044342f1a4^{commit}

The failure here is expected, it just means that an update is
necessary, so suppress output.

mkosi.images/build/mkosi.sync

index 4cb2b41a4e2c8ce503ba404a36d67f50b84c4f34..02d66e993910c93409a74b3252a5b63fdef3c901 100755 (executable)
@@ -8,7 +8,7 @@ if ((${NO_SYNC:-0})) || ((${NO_BUILD:-0})); then
 fi
 
 if [[ -d "pkg/$PKG_SUBDIR/.git" ]]; then
-    if [[ "$(git -C "pkg/$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then
+    if [[ "$(git -C "pkg/$PKG_SUBDIR" rev-parse HEAD 2>/dev/null)" == "$GIT_COMMIT" ]]; then
         exit 0
     fi
 
@@ -43,7 +43,7 @@ if [[ ! -e "pkg/$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")"
         # --no-cone is needed to check out only one top-level directory
         git -C "pkg/$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}"
     fi
-elif ! git -C "pkg/$PKG_SUBDIR" cat-file -e "$GIT_COMMIT^{commit}"; then
+elif ! git -C "pkg/$PKG_SUBDIR" cat-file -e "$GIT_COMMIT^{commit}" 2>/dev/null; then
     git -C "pkg/$PKG_SUBDIR" remote set-url origin "$GIT_URL"
     git -C "pkg/$PKG_SUBDIR" fetch origin "$GIT_BRANCH"
 fi