From 771ba23f26e5d8e04f9ef7aa152be5c48267b56d Mon Sep 17 00:00:00 2001 From: Shrey Banga Date: Thu, 28 Dec 2023 10:08:53 -0500 Subject: [PATCH] Add a script to help repro https://github.com/banga/git-split-diffs/issues/16 --- .gitignore | 3 ++- .vscode/settings.json | 13 +++++++++++-- scripts/test.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 scripts/test.sh diff --git a/.gitignore b/.gitignore index e856a6b..eecc993 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/** build/** -.DS_Store \ No newline at end of file +git-test +.DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json index 89d1965..4887642 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,13 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode" -} \ No newline at end of file + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[shellscript]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "[ignore]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "[properties]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + } +} diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..c35b808 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# A script to quickly generate a random diff and display it. Hopefully this will +# help repro https://github.com/banga/git-split-diffs/issues/16. + +set -e +set -x + +cd git-test + +git init +touch src.ts + +choice=$((RANDOM % 2)) + +case $choice in +0) + echo 'Appending some lines' + cat ../src/context.ts >>src.ts + ;; +1) + echo 'Deleting half the lines' + sed -i '' -n 'p;n' src.ts + ;; +esac + +git commit -am "$(date)" +git show + +cd -