* -p diff output and the 'Index:' line
@ 2005-05-29 7:15 Petr Baudis
2005-05-29 7:41 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2005-05-29 7:15 UTC (permalink / raw)
To: git
Hello,
so I've tried how would cg-diff output look like if I used the
git-diff -p argument, and I found that I miss the 'Index:' line.
Actually, what I really miss is the separator ==== line just below, but
it'd probably look weird without the 'Index:' line. I became used to the
separators and they enable me to quickly visually notice the files
boundary, which is more drudging if you have just the 'diff --git' line.
What do you think? Would you hate it to show up in the diffs, or are
you ok with it?
Thanks,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 7:15 -p diff output and the 'Index:' line Petr Baudis
@ 2005-05-29 7:41 ` Junio C Hamano
2005-05-29 7:52 ` Sean
2005-05-29 12:02 ` Petr Baudis
0 siblings, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2005-05-29 7:41 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> What do you think? Would you hate it to show up in the diffs, or are
PB> you ok with it?
I cannot tell if you are asking about cg-diff or changing the
built-in diff-* output. The Subject: line suggests you are
talking about the latter, but if that is the case I have to
admit that I am not that sympathetic to Index: nor separator.
Like Linus, I do "/^diff --git .*" in my less sessions, which
gives a very nice highlighted separator line without wasting a
single line on the terminal. If any of the readers on the list
didn't know about this trick (especially the trailing .* part),
please try it. I'm certain everybody would love it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 7:41 ` Junio C Hamano
@ 2005-05-29 7:52 ` Sean
2005-05-29 12:36 ` Thomas Glanzmann
2005-05-29 12:02 ` Petr Baudis
1 sibling, 1 reply; 9+ messages in thread
From: Sean @ 2005-05-29 7:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Petr Baudis, git
On Sun, May 29, 2005 3:41 am, Junio C Hamano said:
>>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>
> PB> What do you think? Would you hate it to show up in the diffs, or are
> PB> you ok with it?
>
> I cannot tell if you are asking about cg-diff or changing the
> built-in diff-* output. The Subject: line suggests you are
> talking about the latter, but if that is the case I have to
> admit that I am not that sympathetic to Index: nor separator.
>
> Like Linus, I do "/^diff --git .*" in my less sessions, which
> gives a very nice highlighted separator line without wasting a
> single line on the terminal. If any of the readers on the list
> didn't know about this trick (especially the trailing .* part),
> please try it. I'm certain everybody would love it.
It's good to know you can wrap this into a shell script too, which saves
you having to type the search string in "less" each time... something
like:
git-diff-tree "$@" | git-diff-helper | less -p "^diff --git .*"
Sean
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 7:41 ` Junio C Hamano
2005-05-29 7:52 ` Sean
@ 2005-05-29 12:02 ` Petr Baudis
2005-05-29 18:04 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2005-05-29 12:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Sun, May 29, 2005 at 09:41:03AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> >>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>
> PB> What do you think? Would you hate it to show up in the diffs, or are
> PB> you ok with it?
>
> I cannot tell if you are asking about cg-diff or changing the
> built-in diff-* output. The Subject: line suggests you are
> talking about the latter, but if that is the case I have to
> admit that I am not that sympathetic to Index: nor separator.
Yes, I'm talking about the latter.
> Like Linus, I do "/^diff --git .*" in my less sessions, which
> gives a very nice highlighted separator line without wasting a
> single line on the terminal. If any of the readers on the list
> didn't know about this trick (especially the trailing .* part),
> please try it. I'm certain everybody would love it.
When I do just cg-diff to see what I changed I usually do not pipe it to
less, and typing that / stuff seems insane (although /^d.* could give a
good approximation). OTOH I think I'll go for the diff output
colorification (at the Cogito level), so the separator indeed isn't
strictly necessary. I can live without it. :-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 7:52 ` Sean
@ 2005-05-29 12:36 ` Thomas Glanzmann
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Glanzmann @ 2005-05-29 12:36 UTC (permalink / raw)
To: Sean; +Cc: Junio C Hamano, Petr Baudis, git
Hello,
I actually use the following bash script to browse the diffs with
what-changed:
(faui03) [~/work/monitor] git-whatchanged -p | cdiff
...
# COLORDEFINITIONS
BLACK="^[[0;30m"
RED="^[[0;31m"
GREEN="^[[0;32m"
YELLO="^[[0;33m"
BLUE="^[[0;34m"
PURPLE="^[[0;35m"
CYAN="^[[0;36m"
WHITE="^[[0;37m"
END="^[[0m"
REVERSE="^[[7m"
cdiff()
{
cat $1 | \
sed -e " \
s/^\(diff-tree\)\(.*\)/\1${RED}\2${END}/; \
s/^+.*/$RED&$END/; \
s/^-.*/$BLUE&$END/; \
s/^@.*/$GREEN&$END/; \
s/^Date.*/$RED&$END/; \
s/^Author.*/$RED&$END/; \
" | less -R -i -p "^diff-tree"
# This would highlight manpages but the last line clashes with cdiff
# --tg 00:52 05-05-26
#s/^[A-Z]\+[A-Z ]\+$/$RED&$END/; \
#s/[A-Z]\+([0-9])/$RED&$END/g; \
# s/\W--\?[0-9a-zA-Z=-]\+/$BLUE&$END/g; \
}
Gruesse,
Thomas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 12:02 ` Petr Baudis
@ 2005-05-29 18:04 ` Junio C Hamano
2005-05-29 19:03 ` Petr Baudis
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-05-29 18:04 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>> Like Linus, I do "/^diff --git .*" in my less sessions, which
>> gives a very nice highlighted separator line without wasting a
>> single line on the terminal. If any of the readers on the list
>> didn't know about this trick (especially the trailing .* part),
>> please try it. I'm certain everybody would love it.
PB> When I do just cg-diff to see what I changed I usually do not pipe it to
PB> less, and typing that / stuff seems insane (although /^d.* could give a
PB> good approximation).
You said you do not do "less", so the following may not apply to
your usage, but I disagree your comment about "typing that /
stuff seems insane". Sean's workaround to use "less -p '^diff
--git .*'" in a script, combined with typing 'n' in a "less"
session to find the next such line, would make it very pleasant
to use.
PB> OTOH I think I'll go for the diff output colorification (at
PB> the Cogito level), so the separator indeed isn't strictly
PB> necessary. I can live without it. :-)
When I want to make a customized diff output out of the "diff-*
-p' command, I find it a lot easier to use the GIT_EXTERNAL_DIFF
mechanism than parsing what comes out of "diff-* -p" and munging
it. I am not _telling_, _ordering_, nor even _asking_ you to
use GIT_EXTERNAL_DIFF; just suggesting you to consider that as a
way to possibly make your implementation easier. I'd start from
the supplied git-external-diff-script and go from there.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 18:04 ` Junio C Hamano
@ 2005-05-29 19:03 ` Petr Baudis
2005-05-30 7:42 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2005-05-29 19:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Sun, May 29, 2005 at 08:04:44PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> You said you do not do "less", so the following may not apply to
> your usage, but I disagree your comment about "typing that /
> stuff seems insane". Sean's workaround to use "less -p '^diff
> --git .*'" in a script, combined with typing 'n' in a "less"
> session to find the next such line, would make it very pleasant
> to use.
(As long as you don't want to search for something else. ;-)
But yes, I like the less -p hack.
> PB> OTOH I think I'll go for the diff output colorification (at
> PB> the Cogito level), so the separator indeed isn't strictly
> PB> necessary. I can live without it. :-)
>
> When I want to make a customized diff output out of the "diff-*
> -p' command, I find it a lot easier to use the GIT_EXTERNAL_DIFF
> mechanism than parsing what comes out of "diff-* -p" and munging
> it. I am not _telling_, _ordering_, nor even _asking_ you to
> use GIT_EXTERNAL_DIFF; just suggesting you to consider that as a
> way to possibly make your implementation easier. I'd start from
> the supplied git-external-diff-script and go from there.
It's just something along the lines of "Me Og. Og sees /^+/. Og makes
the line green." written in gawk (actually I'm not sure if pure awk
wouldn't do, but I actually don't know the language), so I don't think
the external diff thing would've helped me with that in any way.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-29 19:03 ` Petr Baudis
@ 2005-05-30 7:42 ` Junio C Hamano
2005-05-30 8:30 ` Petr Baudis
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-05-30 7:42 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> It's just something along the lines of "Me Og. Og sees /^+/. Og makes
PB> the line green." written in gawk (actually I'm not sure if pure awk
PB> wouldn't do, but I actually don't know the language), so I don't think
PB> the external diff thing would've helped me with that in any way.
Ah, I see. I thought you were talking about the Index: and
separator lines. Colorizing diff/patch part, you need to parse
the diff output with sed/awk/perl and annotate it anyway, and it
does not matter if you annotate within GIT_EXTERNAL_DIFF or
outside. I agree with you that using GIT_EXTERNAL_DIFF
mechanism would not help you here.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: -p diff output and the 'Index:' line
2005-05-30 7:42 ` Junio C Hamano
@ 2005-05-30 8:30 ` Petr Baudis
0 siblings, 0 replies; 9+ messages in thread
From: Petr Baudis @ 2005-05-30 8:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Mon, May 30, 2005 at 09:42:26AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> >>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>
> PB> It's just something along the lines of "Me Og. Og sees /^+/. Og makes
> PB> the line green." written in gawk (actually I'm not sure if pure awk
> PB> wouldn't do, but I actually don't know the language), so I don't think
> PB> the external diff thing would've helped me with that in any way.
>
> Ah, I see. I thought you were talking about the Index: and
> separator lines. Colorizing diff/patch part, you need to parse
> the diff output with sed/awk/perl and annotate it anyway, and it
> does not matter if you annotate within GIT_EXTERNAL_DIFF or
> outside. I agree with you that using GIT_EXTERNAL_DIFF
> mechanism would not help you here.
Well, I want to finally converge with the diff format to what git uses.
So I'm just colorizing the /^diff --git/ line with a unusually bright
color, which will hopefully make up for the Index: and separator lines.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-05-30 8:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-29 7:15 -p diff output and the 'Index:' line Petr Baudis
2005-05-29 7:41 ` Junio C Hamano
2005-05-29 7:52 ` Sean
2005-05-29 12:36 ` Thomas Glanzmann
2005-05-29 12:02 ` Petr Baudis
2005-05-29 18:04 ` Junio C Hamano
2005-05-29 19:03 ` Petr Baudis
2005-05-30 7:42 ` Junio C Hamano
2005-05-30 8:30 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).