# git-am annoyance

4 messages from 2009-01-27 to 2009-01-27. Participants: Sverre Rabbelier, Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/17397

## Sverre Rabbelier, 2009-01-27 22:07

Subject: git-am annoyance
Message-ID: <bd6139dc0901271407i4406d5e6u6db1df9e5a7bdc4f@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0901271407i4406d5e6u6db1df9e5a7bdc4f%40mail.gmail.com

```
Heya,

Observe what happens if, on accident, rather than running a alias
(amendall), the 'tab' didn't catch on:
$ git am
^C
$ # ok, now what do I do?
$ git status
# On branch checker-caching
nothing to commit (working directory clean)
$ # looks like everything is ok, great
$ # ... some time later
$ # same thing happens
$ git am
cat: /home/sverre/code/Melange/.git/rebase-apply/next: No such file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/utf8: No such file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/keep: No such file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/threeway: No such
file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/apply-opt: No such
file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/sign: No such file or directory
cat: /home/sverre/code/Melange/.git/rebase-apply/next: No such file or directory
/usr/local/libexec/git-core//git-am: line 319: test: : integer
expression expected
/usr/local/libexec/git-core//git-am: line 326: test: : integer
expression expected
$ # whoops?!

Wouldn't it be nice if "git am" without any arguments just prints a
usage message? Either that, or provides you with a way to bail out? Or
if it'd clean up after itself so that it doesn't crash?

-- 
Cheers,

Sverre Rabbelier

```

## Junio C Hamano, 2009-01-27 22:30

Subject: Re: git-am annoyance
Message-ID: <7vr62o1iww.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vr62o1iww.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <bd6139dc0901271407i4406d5e6u6db1df9e5a7bdc4f@mail.gmail.com>

```
Sverre Rabbelier <alturin@gmail.com> writes:

> Observe what happens if, on accident, rather than running a alias
> (amendall), the 'tab' didn't catch on:
> $ git am
> ^C

It wants to read from the stdin as "git am < mbox" is a valid usage.

A patch to detect that the input was killed with ^C and clean things up
would be welcome.  Also we may be able to detect "-t 0", too.

> $ # ok, now what do I do?

Here is one thing you could do.

    $ PS1=': $(__git_ps1 "%s"); '
    : master|AM/REBASE; 
    : master|AM/REBASE; git am --abort

But you are right.  We should be able to detect this.

I think it was just people who often use "am" are so used to correctly the
command that the state where no state files are created didn't happen
often and never reported the breakage.

```

## Sverre Rabbelier, 2009-01-27 22:37

Subject: Re: git-am annoyance
Message-ID: <bd6139dc0901271437l19f1201ch867f1a7c2045e54b@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0901271437l19f1201ch867f1a7c2045e54b%40mail.gmail.com
In-Reply-To: <7vr62o1iww.fsf@gitster.siamese.dyndns.org>

```
On Tue, Jan 27, 2009 at 23:30, Junio C Hamano <gitster@pobox.com> wrote:
> It wants to read from the stdin as "git am < mbox" is a valid usage.

Ah, ofcourse, that makes sense :).

> A patch to detect that the input was killed with ^C and clean things up
> would be welcome.  Also we may be able to detect "-t 0", too.

What is '-t 0'? How would one detect this in bash?

>> $ # ok, now what do I do?
>
> Here is one thing you could do.
>
>    $ PS1=': $(__git_ps1 "%s"); '
>    : master|AM/REBASE;
>    : master|AM/REBASE; git am --abort

Ugh, I couldn't even get that thing to work :P.

> But you are right.  We should be able to detect this.

That would be nice indeed.

> I think it was just people who often use "am" are so used to correctly the
> command that the state where no state files are created didn't happen
> often and never reported the breakage.

Ok, am glad I reported it then, now it's a known issue at least.

-- 
Cheers,

Sverre Rabbelier

```

## Johannes Schindelin, 2009-01-27 22:49

Subject: Re: git-am annoyance
Message-ID: <alpine.DEB.1.00.0901272348380.3586@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0901272348380.3586%40pacific.mpi-cbg.de
In-Reply-To: <bd6139dc0901271437l19f1201ch867f1a7c2045e54b@mail.gmail.com>

```
Hi,

On Tue, 27 Jan 2009, Sverre Rabbelier wrote:

> What is '-t 0'? How would one detect this in bash?

It detects if file descriptor 0 (stdin) is a terminal.  "man test" to the 
rescue ;-)

Ciao,
Dscho

P.S.: if I hadn't tried exactly that in my valgrind patches recently, I 
would not have known either...

```
