From 46fbccf71123a96497d84251bdd31b17afe2ec8b Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Thu, 20 Jan 2022 20:39:06 +0100 Subject: [PATCH] tell git to ignore modified `apps.json` when running create_apps.json.sh Only if no arguments given: `create_apps_json.sh apps.json` will leave it alone if someone really wants to overwrite+commit apps.json. --- bin/create_apps_json.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/create_apps_json.sh b/bin/create_apps_json.sh index d61f7afe1..dd883b22a 100755 --- a/bin/create_apps_json.sh +++ b/bin/create_apps_json.sh @@ -36,3 +36,13 @@ for app in apps/*/; do fi done echo "]" >> "$outfile" + +if [ -z "$1"]; then + # Running with no arguments: prevent accidental commit of modified apps.json. + # You can use `create_apps.json.sh apps.json` if you really want to both + # overwrite and still commit apps.json + git update-index --skip-worktree apps.json + echo "Told git to ignore modified apps.json." + # If you want to unignore it, use + # 'git update-index --no-skip-worktree apps.json' +fi \ No newline at end of file