Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:44:34

Brian Gernhardt schrieb:
On May 6, 2008, at 2:32 AM, Johannes Sixt wrote:
quoted
Brian Gernhardt schrieb:
quoted
+    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?
Probably not.
quoted
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.)
Well, I can't think of a use-case where ORIG_HEAD would be extremly useful
for _me_, but you argued for one (git pull --rebase), so you make it so
that it suits you. I'm just drawing a scenario where ORIG_HEAD possibly is
not what you expect.

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help