git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git diffall, open all diff files immediatly (eg tabbed window in BC)
@ 2009-08-21  3:47 Seba Illingworth
  2009-08-21  5:40 ` David Aguilar
  0 siblings, 1 reply; 5+ messages in thread
From: Seba Illingworth @ 2009-08-21  3:47 UTC (permalink / raw)
  To: git

I came up with the following 'git-diffall' script to open all diff files
immediately, rather than default behavior of opening them one at a 
time in serial.

    for name in $(git diff --name-only $1); do git difftool $1 $name & done

I blogged the details at 
http://blog.codefarm.co.nz/2009/08/git-diff-and-difftool-open-all-files.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git diffall, open all diff files immediatly (eg tabbed window in BC)
  2009-08-21  3:47 git diffall, open all diff files immediatly (eg tabbed window in BC) Seba Illingworth
@ 2009-08-21  5:40 ` David Aguilar
  2009-08-21  5:54   ` Seba Illingworth
  0 siblings, 1 reply; 5+ messages in thread
From: David Aguilar @ 2009-08-21  5:40 UTC (permalink / raw)
  To: Seba Illingworth; +Cc: git

Hi,

On Fri, Aug 21, 2009 at 03:47:07AM +0000, Seba Illingworth wrote:
> I came up with the following 'git-diffall' script to open all diff files
> immediately, rather than default behavior of opening them one at a 
> time in serial.
> 
>     for name in $(git diff --name-only $1); do git difftool $1 $name & done
> 
> I blogged the details at 
> http://blog.codefarm.co.nz/2009/08/git-diff-and-difftool-open-all-files.html

You must have difftool.prompt (or mergetool.prompt) set to
false, otherwise git would be prompting you during the loop.

To make it work irrespective of the configuration, pass
--no-prompt or -y to difftool.


Also maybe something like:

for name in "$(git diff --name-only "$@")"; do
	git difftool "$@" "$name" &
done

The quotes should make it work paths that have spaces.
The "$@" should let you pass arbitrary parameters to difftool.

Have fun,

-- 
		David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git diffall, open all diff files immediatly (eg tabbed window in BC)
  2009-08-21  5:40 ` David Aguilar
@ 2009-08-21  5:54   ` Seba Illingworth
  2009-08-21 23:45     ` git diffall, open all diff files immediatly (eg tabbed window?in BC) David Aguilar
  0 siblings, 1 reply; 5+ messages in thread
From: Seba Illingworth @ 2009-08-21  5:54 UTC (permalink / raw)
  To: git

David Aguilar <davvid <at> gmail.com> writes:
> To make it work irrespective of the configuration...

Hi David, great to get your comments, thanks for the pointers!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git diffall, open all diff files immediatly (eg tabbed window?in BC)
  2009-08-21  5:54   ` Seba Illingworth
@ 2009-08-21 23:45     ` David Aguilar
  2009-08-22  2:10       ` Seba Illingworth
  0 siblings, 1 reply; 5+ messages in thread
From: David Aguilar @ 2009-08-21 23:45 UTC (permalink / raw)
  To: Seba Illingworth; +Cc: git

On Fri, Aug 21, 2009 at 05:54:48AM +0000, Seba Illingworth wrote:
> David Aguilar <davvid <at> gmail.com> writes:
> > To make it work irrespective of the configuration...
> 
> Hi David, great to get your comments, thanks for the pointers!

One last note (I promise ;)):

I would recommend against saying 'git difftool head' on your
blog beause that only works on OSX with its case-preserving yet
case-insensitive filesystem.  It might be worth mentioning that.

If you try 'git diff head' on a different filesystem (for
example, if you tried it on Linux) you'll find that it doesn't
work because the file is .git/HEAD; .git/head doesn't exist.

On OSX the filesystem tells git that .git/head exists even
though it's actually finding .git/HEAD.

-- 
		David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git diffall, open all diff files immediatly (eg tabbed window?in BC)
  2009-08-21 23:45     ` git diffall, open all diff files immediatly (eg tabbed window?in BC) David Aguilar
@ 2009-08-22  2:10       ` Seba Illingworth
  0 siblings, 0 replies; 5+ messages in thread
From: Seba Illingworth @ 2009-08-22  2:10 UTC (permalink / raw)
  To: git

David Aguilar <davvid <at> gmail.com> writes:
> I would recommend against saying 'git difftool head' on your
> blog beause that only works on OSX with its case-preserving yet
> case-insensitive filesystem....

Thanks David, understood and updated to 'HEAD'. 'head' had worked for me with my 
sloppy Windows ways ;)

I struggled with your previous suggestion for handling paths with spaces; 
I couldn't get the for-loop to split the input into individual filenames
on the line-break separator (after outer quotes expanded the result?).

But rewriting it this way seems to work well and handles spaces (Windows):

    git diff --name-only "$@" | while read filename; do
        git difftool "$@" --no-prompt "$filename" &
    done

Hope you can comment on this variation? 
And thanks for all the tips! Seba

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-22  2:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-21  3:47 git diffall, open all diff files immediatly (eg tabbed window in BC) Seba Illingworth
2009-08-21  5:40 ` David Aguilar
2009-08-21  5:54   ` Seba Illingworth
2009-08-21 23:45     ` git diffall, open all diff files immediatly (eg tabbed window?in BC) David Aguilar
2009-08-22  2:10       ` Seba Illingworth

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).