Fossil User Forum

Rename AND change
Login

Rename AND change

Rename AND change

(1) By anonymous on 2025-06-27 09:23:31 [link] [source]

The fossil web interface displays the diffs when a file is moved (fossil mv --hard) and then changed and checked in.

In the same situation, the command line (fossil gdif --from prev) shows old name as deleted and new as added and displays no diffs.

Is there a speical reason for that?

(2) By Florian Balmer (florian.balmer) on 2025-06-27 16:24:00 in reply to 1 [link] [source]

Use the -N option to see the diffs.

In the traditional patch format, file renames can't be expressed other than by deleting the old and creating the new file. The web UI in Fossil is probably the only part where file renames are displayed in a more fancy style. Maybe a question of time or interest available to implement such a feature, but maybe also limited by what external (g)diff tools expect.

(3.2) By Warren Young (wyoung) on 2025-06-27 22:34:25 edited from 3.1 in reply to 2 [source]

That will show a whole-file diff, not the single change the OP speaks of:

$ fossil init x.fossil
$ fossil open -f x.fossil
$ echo foo > test.txt
$ fossil add test.txt 
ADDED  test.txt
$ fossil ci -m 'created test file'
New_Version: 922951d539245ed0bc06069c29a0d6d3df6e1b8e69f156d636b5185ee7fd1abe
$ fossil mv --hard test.txt new-test.txt
RENAME test.txt new-test.txt
MOVED_FILE ~/tmp/test.txt
$ echo bar >> new-test.txt 
$ fossil ci -m 'modified and renamed test file'
New_Version: 239b3fe48ec3ac3256311c0616cee6959671759264237755455f7bf70bef2961
$ fossil diff --from prev -N
ADDED    new-test.txt
Index: new-test.txt
==================================================================
--- /dev/null
+++ new-test.txt
@@ -0,0 +1,2 @@
+foo
+bar

DELETED  test.txt
Index: test.txt
==================================================================

What the OP wants, I believe, is for that diff to show "+bar" alone and not claim that "+foo" is also part of the difference between these versions.

It behaves as it does because Fossil's diff setup code isn't smart enough to track the rename back through the versions and present the intended artifacts to the actual diffing engine. There is only one place in Fossil that does that at the moment, and that's the /finfo view. Alas, that means the near-equivalent fossil finfo CLI view does not have this ability, because the code that does that rename tracking is down in finfo_page(), and not factored out into a function that finfo_cmd() can call.

What the OP is talking about is a third use case for that factored-out function, which is likely to result in it being a fully general mechanism, not a one-off solution.

All we need is someone to do the work.