From fbe366d34b64e328e2b4446b6762c496c3b85a80 Mon Sep 17 00:00:00 2001 From: C Fraire Date: Thu, 19 Apr 2012 15:06:48 -0400 Subject: [PATCH 1/2] copy-back only where files diff - avoiding superfluous copies which Xcode would still handle as file modification events - output copy-back diff to console, which is useful to show changes made in difftool which are copied-back; but also to show any changes made in working_tree since diffall started which are overwritten by copy-back --- git-diffall | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git-diffall b/git-diffall index 84f2b65..825796c 100755 --- a/git-diffall +++ b/git-diffall @@ -252,6 +252,10 @@ then find "$tmp/$right_dir" -type f | while read file do - cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}" + copy_target="$git_top_dir/${file#$tmp/$right_dir/}" + diff -pN "$copy_target" "$file" + if [ $? -ne 0 ]; then + cp "$file" "$copy_target" + fi done fi From ed5035ab67f8844a08497eae0e4d129c2561a757 Mon Sep 17 00:00:00 2001 From: C Fraire Date: Thu, 26 Apr 2012 17:15:18 -0400 Subject: [PATCH 2/2] Fix: git style problems, -N does not work with all diffutils - instead of -N, detect a missing working_tree file and report with a one line notice, "copy-back: ..." --- git-diffall | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/git-diffall b/git-diffall index 825796c..c0e5d0b 100755 --- a/git-diffall +++ b/git-diffall @@ -253,9 +253,17 @@ then while read file do copy_target="$git_top_dir/${file#$tmp/$right_dir/}" - diff -pN "$copy_target" "$file" - if [ $? -ne 0 ]; then - cp "$file" "$copy_target" + if test -f "$copy_target" + then + diff -p "$copy_target" "$file" + should_cp=$? + else + echo "copy-back: $copy_target: Missing file is copied back" + should_cp=1 + fi + if test $should_cp -ne 0 + then + cp "$file" "$copy_target" fi done fi