commit 102c5b01b1d70fdad9ea8776a83a26627af02abe from: vincent delft date: Sat Feb 21 18:26:07 2026 UTC I've forgotten to update the name of got_sdiff.sh commit - 01cda58f7e88b628f75a9c86b62988b23e4812f5 commit + 102c5b01b1d70fdad9ea8776a83a26627af02abe blob - b7d03f0d07d31b6ffc79c08fc47b8cfe5cd041e3 (mode 755) blob + /dev/null --- alternatif_diff/sdiff.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -#Copyright 2026 vincent.delft@gmail.com -# -#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -# -#1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -# -#2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -# -#3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -file="$1" - -if [ ! -d "./.got" ]; then - echo "Are you sure we are a the root of the project? We should see the '.got' folder" - echo "Go back to root folder of your project and type '${0##*/} path/to/the/file'" - exit 1 -fi - -if [ -z "$file" ]; then - echo "please provide the file you want to compare" - exit 1 -fi - -if [ ! -f "$file" ]; then - echo "We do not find the file called: $file" - exit 1 -fi - -# create a temporary file -committed_file=$(mktemp /tmp/${file##*/}.XXXX) || exit 1 - -# remove the temporary file containing the last committed version of the file -trap 'rm "$committed_file"' EXIT - -# get the last committed version of the file -got cat -c HEAD "$file" > "$committed_file" || exit 1 - -# we want to make sure modifications are put on this temporary file -chmod 400 "$committed_file" - -# make sure you have installed meld: "pkg install meld" or "pkg_add meld" -meld "$file" "$committed_file" - -# to avoid remove at the remove -chmod 600 "$committed_file" blob - /dev/null blob + b7d03f0d07d31b6ffc79c08fc47b8cfe5cd041e3 (mode 755) --- /dev/null +++ alternatif_diff/got_sdiff.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +#Copyright 2026 vincent.delft@gmail.com +# +#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +# +#1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +# +#2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +# +#3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +file="$1" + +if [ ! -d "./.got" ]; then + echo "Are you sure we are a the root of the project? We should see the '.got' folder" + echo "Go back to root folder of your project and type '${0##*/} path/to/the/file'" + exit 1 +fi + +if [ -z "$file" ]; then + echo "please provide the file you want to compare" + exit 1 +fi + +if [ ! -f "$file" ]; then + echo "We do not find the file called: $file" + exit 1 +fi + +# create a temporary file +committed_file=$(mktemp /tmp/${file##*/}.XXXX) || exit 1 + +# remove the temporary file containing the last committed version of the file +trap 'rm "$committed_file"' EXIT + +# get the last committed version of the file +got cat -c HEAD "$file" > "$committed_file" || exit 1 + +# we want to make sure modifications are put on this temporary file +chmod 400 "$committed_file" + +# make sure you have installed meld: "pkg install meld" or "pkg_add meld" +meld "$file" "$committed_file" + +# to avoid remove at the remove +chmod 600 "$committed_file"