git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rebase-merge/done: No such file or directory
@ 2009-01-12 19:13 jidanni
  2009-01-12 22:47 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: jidanni @ 2009-01-12 19:13 UTC (permalink / raw)
  To: johannes.schindelin; +Cc: git

Bug at git-rebase--interactive.sh:107: count=$(grep -c '^[^#]' < "$DONE")

$DONE might not exist. Do test -f $DONE before you grep it.

This will happen if the user gave a wrong squash choice.

$ git rebase --interactive ...
Waiting for Emacs...
grep: .git/rebase-merge/done: No such file or directory
Cannot 'squash' without a previous commit

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

* Re: rebase-merge/done: No such file or directory
  2009-01-12 19:13 rebase-merge/done: No such file or directory jidanni
@ 2009-01-12 22:47 ` Johannes Schindelin
  2009-01-12 23:02   ` Adeodato Simó
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2009-01-12 22:47 UTC (permalink / raw)
  To: jidanni; +Cc: git

Hi,

On Tue, 13 Jan 2009, jidanni@jidanni.org wrote:

> Bug at git-rebase--interactive.sh:107: count=$(grep -c '^[^#]' < "$DONE")

Woohoo.  Buuuug.

> $DONE might not exist. Do test -f $DONE before you grep it.

I cannot reproduce here.  Since all the files in .git/rebase-merge/ are 
internal files to rebase--interactive, I think we do not have to guard 
against any possible user action rendering assumptions about internals 
invalid.

Wasting a minute, I seem to understand why I cannot reproduce.  Just 
looking all of _two_ lines above the line you mentioned:

	sed -e 1q < "$TODO" >> "$DONE"

Hrmpf.  You're right.  The user could have removed "$DONE"e between the 
two lines ;-)

Hth,
Dscho

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

* Re: rebase-merge/done: No such file or directory
  2009-01-12 22:47 ` Johannes Schindelin
@ 2009-01-12 23:02   ` Adeodato Simó
  2009-01-12 23:09     ` [PATCH] Avoid spurious error messages on error mistakes Pierre Habouzit
  0 siblings, 1 reply; 5+ messages in thread
From: Adeodato Simó @ 2009-01-12 23:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: jidanni, git

* Johannes Schindelin [Mon, 12 Jan 2009 23:47:47 +0100]:

> > $DONE might not exist. Do test -f $DONE before you grep it.

> I cannot reproduce here.  Since all the files in .git/rebase-merge/ are 
> internal files to rebase--interactive, I think we do not have to guard 
> against any possible user action rendering assumptions about internals 
> invalid.

> Wasting a minute, I seem to understand why I cannot reproduce.  Just 
> looking all of _two_ lines above the line you mentioned:

> 	sed -e 1q < "$TODO" >> "$DONE"

> Hrmpf.  You're right.  The user could have removed "$DONE"e between the 
> two lines ;-)

No, not really. Start a rebase -i. Change the *first* "pick" to a
"squash". Save and exit the editor. You'll see the output jidanni
mentioned:

  grep: .git/rebase-merge/done: No such file or directory
  Cannot 'squash' without a previous commit

The second line tells the user what happened (what their error was), but
I guess we could do without the first one.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Debugging is twice as hard as writing the code in the first place. Therefore,
if you write the code as cleverly as possible, you are, by definition, not
smart enough to debug it.
                -- Brian W. Kernighan

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

* [PATCH] Avoid spurious error messages on error mistakes.
  2009-01-12 23:02   ` Adeodato Simó
@ 2009-01-12 23:09     ` Pierre Habouzit
  2009-01-13  8:20       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Habouzit @ 2009-01-12 23:09 UTC (permalink / raw)
  To: git, git; +Cc: Pierre Habouzit

Prior to that, if the user chose "squash" as a first action, the stderr
looked like:

    grep: /home/madcoder/dev/scm/git/.git/rebase-merge/done: No such file or directory
    Cannot 'squash' without a previous commit

Now the first line is gone.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c8b0861..8ed2244 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -349,7 +349,7 @@ do_next () {
 	squash|s)
 		comment_for_reflog squash
 
-		has_action "$DONE" ||
+		test -f "$DONE" && has_action "$DONE" ||
 			die "Cannot 'squash' without a previous commit"
 
 		mark_action_done
-- 
1.6.1.161.g5e07b.dirty


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

* Re: [PATCH] Avoid spurious error messages on error mistakes.
  2009-01-12 23:09     ` [PATCH] Avoid spurious error messages on error mistakes Pierre Habouzit
@ 2009-01-13  8:20       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2009-01-13  8:20 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: git

Pierre Habouzit <madcoder@debian.org> writes:

> Prior to that, if the user chose "squash" as a first action, the stderr
> looked like:
>
>     grep: /home/madcoder/dev/scm/git/.git/rebase-merge/done: No such file or directory
>     Cannot 'squash' without a previous commit
>
> Now the first line is gone.
>
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ---
>  git-rebase--interactive.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index c8b0861..8ed2244 100755
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -349,7 +349,7 @@ do_next () {
>  	squash|s)
>  		comment_for_reflog squash
>  
> -		has_action "$DONE" ||
> +		test -f "$DONE" && has_action "$DONE" ||
>  			die "Cannot 'squash' without a previous commit"
>  
>  		mark_action_done
> -- 
> 1.6.1.161.g5e07b.dirty

Make sense.  Will apply to maint.

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

end of thread, other threads:[~2009-01-13  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-12 19:13 rebase-merge/done: No such file or directory jidanni
2009-01-12 22:47 ` Johannes Schindelin
2009-01-12 23:02   ` Adeodato Simó
2009-01-12 23:09     ` [PATCH] Avoid spurious error messages on error mistakes Pierre Habouzit
2009-01-13  8:20       ` Junio C Hamano

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