Skip to contentSkip to conversation

rebase -m: only call "notes copy" when rewritten exists and is non-empty

PATCH In review Andrew Wong 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rebase -m: only call "notes copy" when rewritten exists and is non-empty

This prevents a shell error complaining rebase-merge/rewritten doesn't exist.

---
 git-rebase--merge.sh |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
git-rebase--merge.sh +5 -4
index 26afc75..5e9d95f 100644
@@ -90,10 +90,11 @@ call_merge () {
 
 finish_rb_merge () {
 	move_to_original_branch
-	git notes copy --for-rewrite=rebase < "$state_dir"/rewritten
-	if test -x "$GIT_DIR"/hooks/post-rewrite &&
-		test -s "$state_dir"/rewritten; then
-		"$GIT_DIR"/hooks/post-rewrite rebase < "$state_dir"/rewritten
+	if test -s "$state_dir"/rewritten; then
+		git notes copy --for-rewrite=rebase < "$state_dir"/rewritten
+		if test -x "$GIT_DIR"/hooks/post-rewrite; then
+			"$GIT_DIR"/hooks/post-rewrite rebase < "$state_dir"/rewritten
+		fi
 	fi
 	rm -r "$state_dir"
 	say All done.
Signature · 1 line
1.7.9.2.263.g07763
#1 lore raw
Quoted 1 line · Andrew Wong

This prevents a shell error complaining rebase-merge/rewritten doesn't exist.

Yeah, the updated logic overall makes more sense, too. "when we have rewritten, then we do these two things" is clear from the text.

Thanks.