Skip to contentSkip to conversation

rebase-merge/done: No such file or directory

PATCH In review [email protected] 5 participants 5 messages Jun 15, 2016 – Aug 13, 2016

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

Hi,

Quoted 1 line · On Tue, 13 Jan 2009, [email protected] wrote:

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

Woohoo. Buuuug.

Quoted 1 line

$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

#2 lore raw
Quoted 7 lines · Johannes Schindelin
Quoted 1 line

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

Quoted 7 lines

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.

Signature · 7 lines
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
#3 lore raw

PATCH 1/1 Avoid spurious error messages on error mistakes.

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.

---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-rebase--interactive.sh +1 -1
index c8b0861..8ed2244 100755
@@ -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
Signature · 1 line
1.6.1.161.g5e07b.dirty
#4 lore raw

Re: [PATCH] Avoid spurious error messages on error mistakes.

Quoted 28 lines · 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.

---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-rebase--interactive.sh +1 -1
index c8b0861..8ed2244 100755
@@ -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
Signature · 1 line
1.6.1.161.g5e07b.dirty

Make sense. Will apply to maint.