Commit Graph

19 Commits

Author SHA1 Message Date
Morgan Schweers ffa2e1aed4 Add stderror to the pipe results, so we can find out what happened when things go wrong. Not an optimal answer, but a quick one. 2010-03-13 12:41:11 -07:00
Pieter de Bie 57168e1ab0 PBEasyPipe: Add method that allows you to specify the environment stuff 2009-06-11 18:56:19 +01:00
Pieter de Bie cc6a91579e PBEasyPipe: Might catch an exception 2009-01-25 15:14:42 +00:00
Pieter de Bie 8fde62f1b0 PBEasyPipe: Wait until exit if we're not in the main thread
There have been numerous bug reports about zombie processes in GitX,
because if an NSThread dies before an NSTask is finished it won't
kill the child process properly.

We tried to fix this by adding an [NSTask waitUntilExit] to wait for the
process to die, fixing the problem with the zombies. However, this caused
another problem: rendering glitches in the history view.

The problem is that [NSTask waitUntilExit] does NOT wait until the task has
finished (yeah, took me some time to figure that one out). Instead, it runs
the main loop and periodically queries if the task has finished yet.

What happens then is that during the drawing of one of the cells a call
is made to [repository headRef] to determine whether we should show the
cell in bold or not.

[repository headRef] then invokes an NSTask to figure out what the HEAD ref
really is. This in turn runs the [NSTask waitUntilExit].

Now, rather than really wait, the NSTask continues the main loop, and Cocoa
tries to display the next cell. This cell again calls an NSTask, etc...

So, what we basically have then is that halfway through the NSCell's drawing
code, the NSCell will be asked to draw another cell. It then changes the
data members and calls the [drawInRect] stuff again. the cell finishes
drawing, and control is returned to the previous draw. This path happily
continues, but now its data members are changed because of the second
draw, so it continues drawing something different than what it started
with.

As you might imagine, it took me some time to figure that one out :) The
next part is to fix it, of course, which might be somewhat tougher.
There's the easy fix to only [waitUntilExit] if the current thread is
not the main thread. This fixes our problem because nothing is drawn
in other threads, and nothing is zombie'd if it's called from the
main thread.

Another way is to fix the drawing code not to use data members. That
way the drawing can continue happily as if nothing ever happend

A third way is to fix the drawing part to never execute a git call.

I think the first and third way are OK to do. The second option doesn't
look very entertaining or practical.

Of course, the first option is only working around the problem, and
only solves this particular case. I guess this is one of those cases
of "I'll work around it this time.. if it bugs me later, I'll fix
it properly".
2009-01-25 02:14:13 +00:00
Pieter de Bie f94ab0f5fe Use NSISOLatin1 encoding instead of ASCII
We used to fall back on the ASCII encoding if UTF-8 did not work out. However,
this causes its own problems; ASCII is only valid for the lower 7 bytes. We
solve this by using Latin-1, which should have a valid character for every
byte sequence
2009-01-19 17:05:32 +00:00
Pieter de Bie 530377a121 PBEasyPipe: Fall back to ASCII encoding when UTF-8 fails
This seems to be the only sensible thing to do, as we can't guess
what the encoding would otherwise be.
2008-12-15 18:00:34 +01:00
Pieter de Bie 0b65b54f7f Add a warning about possible error 2008-12-01 13:07:06 +01:00
Pieter de Bie 3d64d83f98 Create a new SpeedTest target
This adds a new target 'SpeedTest', which just loads in a repository
and displays how long it takes to load the revision. This is handy for
testing the speed of the revwalking mechanism
2008-11-24 22:32:46 +01:00
Pieter de Bie b0caa349ae Revert "Wait for a child to clear it out."
This reverts commit 3922b543ba.

This caused weird drawing glitches when reloading the revision list
2008-11-19 14:54:30 +01:00
Bryce Kerley 3922b543ba Wait for a child to clear it out. 2008-11-17 16:07:30 -05:00
Pieter de Bie 5a7d1e9d30 EasyPipe: Only show debug when user pref is set 2008-10-04 22:41:21 +02:00
Pieter de Bie 2676a20291 Fix some compiler warnings 2008-09-24 01:25:30 +02:00
Pieter de Bie 4024753045 PBEasyPipe: Add a new method to provide input 2008-09-24 01:07:15 +02:00
Pieter de Bie faef971e18 EasyPipe: Add functions to ask for the return value of commands 2008-09-22 21:11:53 +02:00
Pieter de Bie e2b507313b Delete temporary files when they are deallocated
This will remove a lot of the stray files in the
temporary dir. However, they won't be deleted on exit
of the program. What to do about this?
2008-06-17 05:56:00 +02:00
Pieter de Bie cc6ac22047 Allow double click to open file 2008-06-16 14:19:38 +02:00
Pieter de Bie 7cdfdf0954 Use UTF-8 for data decoding 2008-06-16 05:31:12 +02:00
Pieter de Bie bd165e7d29 Output better debug info for NSTask action 2008-06-16 02:01:52 +02:00
Pieter de Bie 08757ad610 Add easy pipe handling library. Use it to find real git repository path
This adds a new class, PBEasyPipe, which can do most of the pipe handling
in an easy way.

We use this to call `git rev-parse --git-dir` to find our current git
repository. This means that we can now call GitX within a subdirectory :)
2008-06-16 01:52:12 +02:00