Re: [PATCH] Make rebase save ORIG_HEAD if using current branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On May 6, 2008, at 2:32 AM, Johannes Sixt wrote:

Brian Gernhardt schrieb:
diff --git a/git-rebase.sh b/git-rebase.sh
index 9b13b83..8d54d9f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -342,6 +342,7 @@ case "$#" in
		branch_name=HEAD ;# detached
	fi
	branch=$(git rev-parse --verify "${branch_name}^0") || exit
+	echo "$branch" > "$GIT_DIR/ORIG_HEAD"

1. You should be using 'git update-ref' here, I think.
2. You should detect errors.

This is exactly how git-merge.sh does it. While that's not a good argument for adding this, perhaps merge should be updated as well. And presumably update-ref will make detecting errors easy. But is being unable to set ORIG_HEAD an error that should stop the entire process?

3. Should ORIG_HEAD better be set at the end of the rebase, not at the
beginning? Because if the rebase stops for some reason, and then you do a 'git reset', you'll have overwritten the ORIG_HEAD that you have set here.

I put it where I did because I thought it would only make sense when rebasing the current HEAD (instead of the two argument version that switches first). Duplicating the logic to determine that later seemed wasteful. Also, might you want to access the original HEAD during a rebase conflict? (Although that would argue that ORIG_HEAD should be set for all rebases, to $upstream.)

~~ Brian
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux