Commit Diff


commit - c85b1bffb399ae7b4294cf58d1fe1f1d2132b6fb
commit + abddef3e5b77eac8b30010d3dbc6c9ce94f63e44
blob - /dev/null
blob + 3c96161df965048facfcc88721f46ce19553815d (mode 644)
--- /dev/null
+++ alternatif_diff/REAMDE.md
@@ -0,0 +1,10 @@
+With got_sdiff.sh I provide a simple way to use your preferred diff tool inside got. 
+
+In other words got_sdiff.sh call your preferred diff tool with the current file present in your project folder and his equivalent in the rpository. 
+The script put the content of the file present in the repository in a temporary file in /tmp and trigger the diff tool with the current file present in the project tree and this temporary one. 
+
+We should not have security issues because the temporary file is only visible by you and removed at the exit of the script. Even is the script abend. 
+
+In this version, I'm using meld as comparatif tool, but you can add the one you prefer by adapting the associated line in the script. 
+
+You could says that got_sdiff is a "got separated diff" or "got special diff", ... it's just an alternative to the standard diff ;)
blob - /dev/null
blob + b7d03f0d07d31b6ffc79c08fc47b8cfe5cd041e3 (mode 755)
--- /dev/null
+++ alternatif_diff/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"