git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v8] diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible

From
Yoshioka Tsuneo <yoshiokatsuneo@gmail.com>
Date
Oct 20, 2013, 01:49 UTC
Message-ID
<BB9AEFCE-0E64-4EAA-8DEA-9A8125B8C553@gmail.com>
In-Reply-To
<87mwm5vkue.fsf@linux-k42r.v.cablecom.net>
Hello Thomas
> Can you briefly describe what you changed in v7 and v8, both compared to
> earlier versions and between v7 and v8?
On v7, <sfx>'s basename part is tried to kept. On v7, whole <sfx> part is tried to kept.
For example, in case below:
   parent_path{sourceDirectory => DestinationDirectory}path1/path2//longlongFilename.txt
 On v7, this can be like:
   …{...ceDirectory => …onDirectory}.../longlongFilename.txt
On v8, it will be like:
   …{...irectory => …irectory}path1/path2/longlongFilename.txt

This change is based on the review from Junio below. (I myself is not sure what is the better way.) ================================ On Oct 17, 2013, at 10:29 PM, Junio C Hamano <gitster@pobox.com> wrote:

Show 10 quoted lines
> I am not sure if distributing the burden of truncation equally to
> three parts so that the resulting pieces are of similar lengths is
> really a good idea.  Between these two
> 
> 	{...SourceDirectory => ...nationDirectory}...ileThatWasMoved 
> 	{...ceDirectory => ...ionDirectory}nameOfTheFileThatWasMoved
> 
> that attempt to show that the file nameOfTheFileThatWasMoved was
> moved from the longSourceDirectory to the DestinationDirectory, the
> latter is much more informative, I would think.
On Oct 18, 2013, at 1:38 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Yoshioka Tsuneo <yoshiokatsuneo@gmail.com> writes:
> 
>> In the "[PATCH v7]", I changed to keep filename part of suffix to handle
>> above case, but not always keep directory part because I feel totally
>> keeping all part of long suffix including directory name may cause output like:
>>    …{… => …}…ongPath1/LongPath2/nameOfTheFileThatWasMoved 
>> And, above may be worse than:
>>   ...{...ceDirectory => …ionDirectory}.../nameOfTheFileThatWasMoved
>> I think.
> 
> I am not sure if I agree.
> 
> Losing LongPath2 part may be more significant data loss than losing
> a single bit that says the change is a rename, as the latter may not
> quite tell us what these two directories were anyway.
================================
Also, I guess Junio might be suspicious to the idea to keep arrow("=>") itself, maybe ?
=================================
(From What's cooking in git.git (Oct 2013, #04; Fri, 18))
- diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible

Attempts to give more weight on the fact that a filepair represents a rename than showing substring of the actual path when diffstat lines are not wide enough.

I am not sure if that is solving a right problem, though. =================================

Thanks!

--- Tsuneo Yoshioka (吉岡 恒夫) yoshiokatsuneo@gmail.com

On Oct 19, 2013, at 9:24 AM, Thomas Rast <tr@thomasrast.ch> wrote:
Show 41 quoted lines
> Yoshioka Tsuneo <yoshiokatsuneo@gmail.com> writes:
> 
>> "git diff -M --stat" can detect rename and show renamed file name like
>> "foofoofoo => barbarbar".
>> 
>> Before this commit, this output is shortened always by omitting left most
>> part like "...foo => barbarbar". So, if the destination filename is too long,
>> source filename putting left or arrow can be totally omitted like
>> "...barbarbar", without including any of "foofoofoo =>".
>> In such a case where arrow symbol is omitted, there is no way to know
>> whether the file is renamed or existed in the original.
>> 
>> Make sure there is always an arrow, like "...foo => ...bar".
>> 
>> The output can contain curly braces('{','}') for grouping.
>> So, in general, the output format is "<pfx>{<mid_a> => <mid_b>}<sfx>"
>> 
>> To keep arrow("=>"), try to omit <pfx> as long as possible at first
>> because later part or changing part will be the more important part.
>> If it is not enough, shorten <mid_a>, <mid_b> trying to have the same
>> maximum length.
>> If it is not enough yet, omit <sfx>.
>> 
>> Signed-off-by: Tsuneo Yoshioka <yoshiokatsuneo@gmail.com>
>> Test-added-by: Thomas Rast <trast@inf.ethz.ch>
>> ---
> 
> Can you briefly describe what you changed in v7 and v8, both compared to
> earlier versions and between v7 and v8?
> 
> It would be very nice if you could always include such a "patch
> changelog" after the "---" above.  git-am will ignore the text between
> "---" and the diff, so you can write comments for the reviewers there
> without creating noise in the commit message.
> 
> Also, please keep reviewers in the Cc list for future discussion/patches
> so that they will see them.
> 
> -- 
> Thomas Rast
> tr@thomasrast.ch
Previous: Thomas RastNext: Junio C Hamano
Message 27 of 31 in “diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.”
  1. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 11, 2013
  2. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 11, 2013
  3. Sam VilainOct 11, 2013
  4. Keshav KiniOct 12, 2013
  5. Yoshioka TsuneoOct 12, 2013
  6. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 12, 2013
  7. Thomas RastOct 13, 2013
  8. Yoshioka TsuneoOct 15, 2013
  9. Duy NguyenOct 14, 2013
  10. Yoshioka TsuneoOct 15, 2013
  11. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 15, 2013
  12. Felipe ContrerasOct 15, 2013
  13. Yoshioka TsuneoOct 15, 2013
  14. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 15, 2013
  15. Junio C HamanoOct 15, 2013
  16. Keshav KiniOct 15, 2013
  17. Yoshioka TsuneoOct 16, 2013
  18. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 16, 2013
  19. Junio C HamanoOct 17, 2013
  20. Yoshioka TsuneoOct 17, 2013
  21. Junio C HamanoOct 17, 2013
  22. Yoshioka TsuneoOct 18, 2013
  23. Junio C HamanoOct 17, 2013
  24. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visibleYoshioka Tsuneo, Oct 17, 2013
  25. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visibleYoshioka Tsuneo, Oct 18, 2013
  26. Thomas RastOct 19, 2013
  27. Yoshioka TsuneoOct 20, 2013
  28. Junio C HamanoOct 22, 2013
  29. Yoshioka TsuneoOct 22, 2013
  30. Junio C HamanoOct 22, 2013
  31. diff.c: keep arrow(=>) on show_stats()'s shortened filename part to make rename visible.Yoshioka Tsuneo, Oct 12, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.