threads / patch / 29738

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

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

## tl;dr

2 messages between Feb 25, 2012 and Feb 27, 2012. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Andrew Wong· Feb 25, 2012, 04:31 UTC · lore
This prevents a shell error complaining rebase-merge/rewritten doesn't exist.
Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
---
 git-rebase--merge.sh |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Show changes to git-rebase--merge.sh +5 −4
diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
index 26afc75..5e9d95f 100644
--- a/git-rebase--merge.sh
+++ b/git-rebase--merge.sh
@@ -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.
-- 
1.7.9.2.263.g07763
Junio C Hamano· Feb 27, 2012, 00:01 UTC · re: Andrew Wong · lore

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

Andrew Wong <andrew.kw.w@gmail.com> writes:
> 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.

← back to recent threads