threads / announce / 17462

[ANNOUNCE] EasyGit (eg) 0.97

Subject: [ANNOUNCE] EasyGit (eg) 0.97

## tl;dr

10 messages between Jan 30, 2009 and Jan 31, 2009.

replies: 9people: 3as markdown or json

Elijah Newren· Jan 30, 2009, 16:42 UTC · lore
=== What is Easy Git? ===

Easy Git (eg) is an alternative frontend for git, specifically designed for former cvs and svn users in order to provide a lower learning curve and prevent common user errors. Since eg largely looks and feels like core git, eg can also serve as a training tool to teach users git (see below for similarities and how to display git commands that eg uses). There is a detailed side-by-side comparison of svn and eg to help svn users make the switch[1]. eg is trivial to install and try out: simply download a single file and stick it in your PATH[2].

=== How different is eg from git? ===

eg is nearly backward-compatible to the core git porcelain, meaning that you can take any git command, replace "git" with "eg" and run it[3]; I believe that any behavioral differences between eg and git can be discovered naturally and innocuously by an existing git user during normal use of eg. Also, you can switch back and forth between git and eg commands in the same project. Finally, eg is also somewhat forward-compatible with the git porcelain, by which I mean that new flags to git commands are often supported automatically in eg even if no modifications are made to eg.

=== If eg is so similar, what is the difference between eg and git? ===
Differences between eg and git[4] basically boil down to:
* eg has a replacement help system that is tutorial oriented for new users
  (these help pages do refer to the git manpages, for more in-depth details)
* eg does extra error checking to avoid some common gotchas
* eg changes some defaults, particularly where git defaults cause
  significant confusion and/or common gotchas for users
* eg has some (occasionally gratuitous) new svn-compatibility subcommands
  (cat, resolved, switch, update)
=== How far along is eg? ===

eg is essentially complete and has been for a while; I've used it daily since last February, and there are multiple other users who do as well. I've even benefitted from having some users who barely grasp the basics of CVS who have tried eg and provided feedback ("[utterly broken workflow] is what I do in CVS! To figure out how to do that in eg I had to go _read_ some of the help pages -- why can't you make it easy?")

eg has just one major bug left that I know of[5]; otherwise it's essentially 1.0. eg requires fairly minimal maintainance -- most new capabilities in git are automatically accessible through eg due to eg's design of passing arguments on to git after optionally massaging them or doing extra checks. In fact, this design also means eg users can benefit from documentation meant for core git, and that eg users should often be able to get help from git users without git users really needing to learn a different UI. On the downside, this design also means that (a) eg feels like an incomplete solution ("why does this message suggest running 'git rebase --continue' when I'm using eg rather than git?"), and (b) eg's interface is not simplified as much as it could be by focusing on a specific use-case (e.g. centralized development) or providing a more orthogonal UI[6]. It does, however, ease transition between the two tools and potentially provide a testbed for ideas that could be adopted by git more easily.

=== What's the path forward? ===

I have no idea. It turns out that eg allowed me to overcome the concerns of others at work that "git was too difficult to use", and was an important part of convincing them to switch to git instead of svn (we're stuck with CVS right now but are working on switching). So eg won't die, unless git itself adopts enough of the improvements in eg. And really, some stuff from eg may just not belong in git, so it may make sense to have an independent script indefinitely (though it could certainly be made much smaller).

What makes sense to the community?  Some possibilities:
* Keep working on eg completely independently
* Propose eg (and perhaps eg-completion.bash) for contrib
* Start a series of discussions on individual changes from eg and see which
  ones the community thinks make sense in git
* Have me stop being lazy and create patches for git as a basis of
  discussion
* Let the crickets chirp (i.e. just ignore this weird Easy Git guy)
* Some combination of the above, or maybe something else entirely?
Elijah

[1] http://www.gnome.org/~newren/eg/git-for-svn-users.html [2] http://www.gnome.org/~newren/eg/download, or [3] If you're curious if/how/when eg changes arguments before passing them to git, you can run "eg --debug ARGS..." to see the git commands eg is running. If you just want to see the git commands that eg would run without them also being executed, you can run "eg --translate ARGS..." [4] For detailed differences, see http://www.gnome.org/~newren/eg/git-eg-differences.html [5] The bug I can only occasionally trigger and which I don't know the cause of yet: when exiting from eg log the terminal settings sometimes are messed up (with echo off and such), requiring a "reset" to get the terminal back to normal. [6] http://marc.info/?l=git&m=122071366316713&w=1

Mike Ralphson· Jan 30, 2009, 16:59 UTC · re: Elijah Newren · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

2009/1/30 Elijah Newren <newren@gmail.com>:
> [5] The bug I can only occasionally trigger and which I don't know the
> cause of yet: when exiting from eg log the terminal settings sometimes
> are messed up (with echo off and such), requiring a "reset" to get the
> terminal back to normal.
Are you sure that isn't this bug in git.git ?

pager: do wait_for_pager on signal death http://article.gmane.org/gmane.comp.version-control.git/106728

Mike
Elijah Newren· Jan 30, 2009, 18:35 UTC · re: Mike Ralphson · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 9:59 AM, Mike Ralphson <mike.ralphson@gmail.com> wrote:
Show 10 quoted lines
> 2009/1/30 Elijah Newren <newren@gmail.com>:
>> [5] The bug I can only occasionally trigger and which I don't know the
>> cause of yet: when exiting from eg log the terminal settings sometimes
>> are messed up (with echo off and such), requiring a "reset" to get the
>> terminal back to normal.
>
> Are you sure that isn't this bug in git.git ?
>
> pager: do wait_for_pager on signal death
> http://article.gmane.org/gmane.comp.version-control.git/106728

Interesting. I just went and tried out next (git version 1.6.1.2.418.gd79e6), which I believe has this patch...and after a while I was still able to duplicate the eg bug on one of my machines[1]. So it doesn't seem to be that particular issue, at least.

Thanks for the pointer.
Elijah

[1] Output of stty after I trigger the eg/git bug: speed 38400 baud; line=0; lnext = <undef>; min = 1; time = 0; -icrnl -icanon -echo

Jeff King· Jan 30, 2009, 19:47 UTC · re: Elijah Newren · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 11:35:50AM -0700, Elijah Newren wrote:
Show 16 quoted lines
> > 2009/1/30 Elijah Newren <newren@gmail.com>:
> >> [5] The bug I can only occasionally trigger and which I don't know the
> >> cause of yet: when exiting from eg log the terminal settings sometimes
> >> are messed up (with echo off and such), requiring a "reset" to get the
> >> terminal back to normal.
> >
> > Are you sure that isn't this bug in git.git ?
> >
> > pager: do wait_for_pager on signal death
> > http://article.gmane.org/gmane.comp.version-control.git/106728
> 
> Interesting.  I just went and tried out next (git version
> 1.6.1.2.418.gd79e6), which I believe has this patch...and after a
> while I was still able to duplicate the eg bug on one of my
> machines[1].  So it doesn't seem to be that particular issue, at
> least.

There is also a related set of fixes for spawning externals via fork, which fixes a bug with the pager not getting cleaned up. But it looks like it is also in the version you tested.

Can you give a more complete recipe for reproducing? Since I was just touching this area in git, I want to make sure it isn't a git bug you are triggering. :)

As an aside, I found some related weirdness. In my git repo, if I do this:

  $ git checkout next
  $ eg log -p

I get log output, but the diff is not colorized (and I have color.diff set to "auto" in my ~/.gitconfig). But if I detach my HEAD and show the log:

  $ git checkout next^0
  $ eg log -p
then I _do_ get color in the patch. I also get this error:
  Use of uninitialized value $branch in concatenation (.) or string at
  /home/peff/eg line 2854.
  eg: command (git rev-parse refs/heads/) failed
  eg: received signal 13
The error is easy to explain. The offending code is:
    my $branch = RepoUtil::current_branch();
    my ($ret, $revision) =
      ExecUtil::execute_captured("git rev-parse refs/heads/$branch");

So it is clear that you just need to handle the case of there being no current branch. But the color thing is certainly exotic. :)

-Peff
Jeff King· Jan 30, 2009, 20:03 UTC · re: Jeff King · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 02:47:27PM -0500, Jeff King wrote:
Show 7 quoted lines
> There is also a related set of fixes for spawning externals via fork,
> which fixes a bug with the pager not getting cleaned up. But it looks
> like it is also in the version you tested.
> 
> Can you give a more complete recipe for reproducing? Since I was just
> touching this area in git, I want to make sure it isn't a git bug you
> are triggering. :)

Ah, OK. I just peeked through the 'eg' source. It looks like you may have replicated the same bug that I just fixed in git. :)

You want to make sure that "eg" is the last process to die (i.e., _after_ the pager). Otherwise after it dies, less has trouble reading from the terminal (I don't know for sure, but I assume this has to do with the shell making "eg" the process group leader and magic about process groups and controlling terminals).

I think perl may even do the wait() for you under ordinary circumstances. But, for example, if I kill "eg" with a signal (say, by hitting ^C), then it will die but the pager will live on. In git, we catch the signal and wait() before dying.

So I don't know for sure that is your problem (it really depends on how much magic perl is doing behind the scenes with wait()ing on children, and I don't recall the exact details of that). But it is something to look into.

I don't think it's a git problem, though. "eg log" doesn't spawn a git pager, since you pipe the output into eg. The paging is all your local "less" invocation.

-Peff
Elijah Newren· Jan 30, 2009, 20:22 UTC · re: Jeff King · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 1:03 PM, Jeff King <peff@peff.net> wrote:
Show 18 quoted lines
> Ah, OK. I just peeked through the 'eg' source. It looks like you may
> have replicated the same bug that I just fixed in git. :)
>
> You  want to make sure that "eg" is the last process to die (i.e.,
> _after_ the pager). Otherwise after it dies, less has trouble reading
> from the terminal (I don't know for sure, but I assume this has to do
> with the shell making "eg" the process group leader and magic about
> process groups and controlling terminals).
>
> I think perl may even do the wait() for you under ordinary
> circumstances. But, for example, if I kill "eg" with a signal (say, by
> hitting ^C), then it will die but the pager will live on. In git, we
> catch the signal and wait() before dying.
>
> So I don't know for sure that is your problem (it really depends on how
> much magic perl is doing behind the scenes with wait()ing on children,
> and I don't recall the exact details of that). But it is something to
> look into.
Thanks for the tips; I'll try to take a look and see what I can figure out.
Elijah
Elijah Newren· Jan 30, 2009, 20:21 UTC · re: Jeff King · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 12:47 PM, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> As an aside, I found some related weirdness. In my git repo, if I do
> this:
>
>  $ git checkout next
>  $ eg log -p
>
> I get log output, but the diff is not colorized (and I have color.diff
> set to "auto" in my ~/.gitconfig). But if I detach my HEAD and show the
> log:
>
>  $ git checkout next^0
>  $ eg log -p
>
> then I _do_ get color in the patch. I also get this error:

Hmm, I had never turned color on before; I guess other eg users hadn't either. Anyway, the difference can be explained pretty easily: eg log tries to provide user-meaningful names for how commits relate to the active branch (like git-name-rev but implemented internally in eg to allow the common case to be fast); if there is no active branch there's no special naming to do so I simply run git log without reading and modifying its output.

Essentially, the difference in coloring here is much like the difference you see between

$ git log $ git log | less

Whenever I try to load the output in perl, git won't show the colorization. I guess I could manually add it when I am printing the information, but it'd be nicer to just have git do the colorization despite the fact that its output is not a tty. Is there an easy way to do that (without mucking with the user's config file)?

(It looks like eg status is also affected, for similar reasons.)
Show 10 quoted lines
>  Use of uninitialized value $branch in concatenation (.) or string at
>  /home/peff/eg line 2854.
>  eg: command (git rev-parse refs/heads/) failed
>  eg: received signal 13
>
> The error is easy to explain. The offending code is:
>
>    my $branch = RepoUtil::current_branch();
>    my ($ret, $revision) =
>      ExecUtil::execute_captured("git rev-parse refs/heads/$branch");
Indeed, the latter two lines should have been after the if (!$branch) check.

Thanks, Elijah

Jeff King· Jan 30, 2009, 20:29 UTC · re: Elijah Newren · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 01:21:00PM -0700, Elijah Newren wrote:
Show 7 quoted lines
> Whenever I try to load the output in perl, git won't show the
> colorization.  I guess I could manually add it when I am printing the
> information, but it'd be nicer to just have git do the colorization
> despite the fact that its output is not a tty.  Is there an easy way
> to do that (without mucking with the user's config file)?
> 
> (It looks like eg status is also affected, for similar reasons.)

If you pass --color on the command line, it is equivalent to "color = always" (whereas the default is "auto", which turns it on only if output is to a tty).

So you would have to read color.diff yourself and then decide whether to add --color.

Note that in general you are playing things a bit risky with these sorts of outputs. You are calling porcelain (like log and status) and piping it into your program. There's no guarantee that user config might not be affecting the results of those programs.

But I think that is sort of the nature of "eg": to be a thin wrapper around git. So maybe it is OK for your use.

-Peff
Elijah Newren· Jan 30, 2009, 22:55 UTC · re: Jeff King · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 1:29 PM, Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
> If you pass --color on the command line, it is equivalent to "color =
> always" (whereas the default is "auto", which turns it on only if output
> is to a tty).
>
> So you would have to read color.diff yourself and then decide whether to
> add --color.

It looks like I can also set the environment variable GIT_PAGER_IN_USE to achieve the same effects (and I don't even need to do so for most commands, such as diff, just those whose output I'm parsing and possibly tweaking).

Show 7 quoted lines
> Note that in general you are playing things a bit risky with these sorts
> of outputs. You are calling porcelain (like log and status) and piping
> it into your program. There's no guarantee that user config might not be
> affecting the results of those programs.
>
> But I think that is sort of the nature of "eg": to be a thin wrapper
> around git. So maybe it is OK for your use.

Right, I considered switching eg to use git plumbing commands to insulate from issues like this, but the problem is that if git output changes then the eg output really should change too (or else I should have a very specific reason for not changing it). This almost certainly means that I'll have to bump the minimum git version to be used with eg at some point, but that seemed the most reasonable path for eg.

Jeff King· Jan 31, 2009, 07:25 UTC · re: Elijah Newren · lore

Re: [ANNOUNCE] EasyGit (eg) 0.97

On Fri, Jan 30, 2009 at 03:55:28PM -0700, Elijah Newren wrote:
Show 7 quoted lines
> > So you would have to read color.diff yourself and then decide whether to
> > add --color.
> 
> It looks like I can also set the environment variable GIT_PAGER_IN_USE
> to achieve the same effects (and I don't even need to do so for most
> commands, such as diff, just those whose output I'm parsing and
> possibly tweaking).

Ah, right. I forgot about that. Yes, setting GIT_PAGER_IN_USE should work, I think.

-Peff

← back to recent threads