* Transfer notes when rebasing @ 2013-09-04 7:51 Francis Moreau 2013-09-04 7:53 ` Jeff King 0 siblings, 1 reply; 7+ messages in thread From: Francis Moreau @ 2013-09-04 7:51 UTC (permalink / raw) To: git@vger.kernel.org Hello, When rebasing a branch which contains commits with notes onto another branch it happens that some commits are already presents in the target branch. In that case git-rebase correctly drops those (already present) commits but it also drops the notes associated with them. Can the notes be transfered somehow in the target branch on the already present commits ? Thanks -- Francis ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 7:51 Transfer notes when rebasing Francis Moreau @ 2013-09-04 7:53 ` Jeff King 2013-09-04 7:59 ` John Keeping 0 siblings, 1 reply; 7+ messages in thread From: Jeff King @ 2013-09-04 7:53 UTC (permalink / raw) To: Francis Moreau; +Cc: git@vger.kernel.org On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote: > When rebasing a branch which contains commits with notes onto another > branch it happens that some commits are already presents in the target > branch. > > In that case git-rebase correctly drops those (already present) > commits but it also drops the notes associated with them. > > Can the notes be transfered somehow in the target branch on the > already present commits ? Yes, see the notes.rewriteRef config option to enable this. -Peff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 7:53 ` Jeff King @ 2013-09-04 7:59 ` John Keeping 2013-09-04 8:03 ` Francis Moreau 2013-09-04 8:28 ` Jeff King 0 siblings, 2 replies; 7+ messages in thread From: John Keeping @ 2013-09-04 7:59 UTC (permalink / raw) To: Jeff King; +Cc: Francis Moreau, git@vger.kernel.org On Wed, Sep 04, 2013 at 03:53:10AM -0400, Jeff King wrote: > On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote: > > > When rebasing a branch which contains commits with notes onto another > > branch it happens that some commits are already presents in the target > > branch. > > > > In that case git-rebase correctly drops those (already present) > > commits but it also drops the notes associated with them. > > > > Can the notes be transfered somehow in the target branch on the > > already present commits ? > > Yes, see the notes.rewriteRef config option to enable this. Does that actually work for this case? It sounds like Francis has the notes copying correctly when commits are rewritten but the notes are not copied anywhere if the commit becomes empty. I suspect it is difficult to do that in general as there is no clear way to know which commit those notes should be copied to. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 7:59 ` John Keeping @ 2013-09-04 8:03 ` Francis Moreau 2013-09-04 8:28 ` Jeff King 1 sibling, 0 replies; 7+ messages in thread From: Francis Moreau @ 2013-09-04 8:03 UTC (permalink / raw) To: John Keeping; +Cc: Jeff King, git@vger.kernel.org On Wed, Sep 4, 2013 at 9:59 AM, John Keeping <john@keeping.me.uk> wrote: > On Wed, Sep 04, 2013 at 03:53:10AM -0400, Jeff King wrote: >> On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote: >> >> > When rebasing a branch which contains commits with notes onto another >> > branch it happens that some commits are already presents in the target >> > branch. >> > >> > In that case git-rebase correctly drops those (already present) >> > commits but it also drops the notes associated with them. >> > >> > Can the notes be transfered somehow in the target branch on the >> > already present commits ? >> >> Yes, see the notes.rewriteRef config option to enable this. > > Does that actually work for this case? It sounds like Francis has the > notes copying correctly when commits are rewritten but the notes are not > copied anywhere if the commit becomes empty. I don't think so: $ git config -l ... notes.rewriteref=refs/notes/* $ git notes show note 1 $ git checkout -b target master~1 Switched to a new branch 'target' $ git cherry-pick -x master [target 93740ff] commit 6 (cherry picked from commit 5dc90209d7c0195dd9d671c234c49c903b9e1b10) 1 file changed, 1 insertion(+) $ git rebase target master First, rewinding head to replay your work on top of it... $ git notes show error: No note found for object 93740ff96b37b2ed7aa0a78861c8beb87fdad474. Thanks -- Francis ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 7:59 ` John Keeping 2013-09-04 8:03 ` Francis Moreau @ 2013-09-04 8:28 ` Jeff King 2013-09-04 8:47 ` Francis Moreau 1 sibling, 1 reply; 7+ messages in thread From: Jeff King @ 2013-09-04 8:28 UTC (permalink / raw) To: John Keeping; +Cc: Francis Moreau, git@vger.kernel.org On Wed, Sep 04, 2013 at 08:59:41AM +0100, John Keeping wrote: > On Wed, Sep 04, 2013 at 03:53:10AM -0400, Jeff King wrote: > > On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote: > > > > > When rebasing a branch which contains commits with notes onto another > > > branch it happens that some commits are already presents in the target > > > branch. > > > > > > In that case git-rebase correctly drops those (already present) > > > commits but it also drops the notes associated with them. > > > > > > Can the notes be transfered somehow in the target branch on the > > > already present commits ? > > > > Yes, see the notes.rewriteRef config option to enable this. > > Does that actually work for this case? It sounds like Francis has the > notes copying correctly when commits are rewritten but the notes are not > copied anywhere if the commit becomes empty. Ah, I misunderstood. If we are dropping commits from the rebase because their counterpart is already applied upstream, then no, there isn't an automatic way to do this. If the commits are dropped because a commit with the same patch-id already exists upstream, you could match them up by patch-id and copy the notes. Annoyingly, while we have things like "log --cherry-mark" to show which commits are already present on each side, I do not think there is a way to correlate them commit for commit. So I think you are stuck doing something in the shell like: patch_ids() { git rev-list "$1" | git diff-tree --stdin -p | git patch-id | sort } patch_ids $upstream..HEAD >us patch_ids HEAD..$upstream >them join us them | cut -d' ' -f2-3 | git notes copy --stdin However, if the commit is dropped because we find while applying that it becomes empty, there is not much we can do. It may have been obsoleted by its counterpart patch that had a different patch-id, or it may even have been obsoleted by unrelated patches. In the latter case, there is nothing to copy to. In the former, you would have to trying to match up the commit messages or similar to guess that the two commits correspond. -Peff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 8:28 ` Jeff King @ 2013-09-04 8:47 ` Francis Moreau 2013-09-04 8:49 ` Jeff King 0 siblings, 1 reply; 7+ messages in thread From: Francis Moreau @ 2013-09-04 8:47 UTC (permalink / raw) To: Jeff King; +Cc: John Keeping, git@vger.kernel.org On Wed, Sep 4, 2013 at 10:28 AM, Jeff King <peff@peff.net> wrote: > On Wed, Sep 04, 2013 at 08:59:41AM +0100, John Keeping wrote: > >> On Wed, Sep 04, 2013 at 03:53:10AM -0400, Jeff King wrote: >> > On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote: >> > >> > > When rebasing a branch which contains commits with notes onto another >> > > branch it happens that some commits are already presents in the target >> > > branch. >> > > >> > > In that case git-rebase correctly drops those (already present) >> > > commits but it also drops the notes associated with them. >> > > >> > > Can the notes be transfered somehow in the target branch on the >> > > already present commits ? >> > >> > Yes, see the notes.rewriteRef config option to enable this. >> >> Does that actually work for this case? It sounds like Francis has the >> notes copying correctly when commits are rewritten but the notes are not >> copied anywhere if the commit becomes empty. > > Ah, I misunderstood. If we are dropping commits from the rebase because > their counterpart is already applied upstream, then no, there isn't an > automatic way to do this. > > If the commits are dropped because a commit with the same patch-id > already exists upstream, you could match them up by patch-id and copy > the notes. Annoyingly, while we have things like "log --cherry-mark" to > show which commits are already present on each side, I do not think > there is a way to correlate them commit for commit. So I think you are > stuck doing something in the shell like: > > patch_ids() { > git rev-list "$1" | > git diff-tree --stdin -p | > git patch-id | > sort > } > > patch_ids $upstream..HEAD >us > patch_ids HEAD..$upstream >them > > join us them | > cut -d' ' -f2-3 | > git notes copy --stdin > > However, if the commit is dropped because we find while applying that it > becomes empty, there is not much we can do. It may have been obsoleted > by its counterpart patch that had a different patch-id, or it may even > have been obsoleted by unrelated patches. In the latter case, there is > nothing to copy to. In the former, you would have to trying to match up > the commit messages or similar to guess that the two commits correspond. Can't git-rebase at least handle the case where a patch and its counterpart have the same patch-id ? Also maybe git-rebase should warn when dropping a commit having a note to tell the user that the note is dropped too. -- Francis ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Transfer notes when rebasing 2013-09-04 8:47 ` Francis Moreau @ 2013-09-04 8:49 ` Jeff King 0 siblings, 0 replies; 7+ messages in thread From: Jeff King @ 2013-09-04 8:49 UTC (permalink / raw) To: Francis Moreau; +Cc: John Keeping, git@vger.kernel.org On Wed, Sep 04, 2013 at 10:47:22AM +0200, Francis Moreau wrote: > > However, if the commit is dropped because we find while applying that it > > becomes empty, there is not much we can do. It may have been obsoleted > > by its counterpart patch that had a different patch-id, or it may even > > have been obsoleted by unrelated patches. In the latter case, there is > > nothing to copy to. In the former, you would have to trying to match up > > the commit messages or similar to guess that the two commits correspond. > > Can't git-rebase at least handle the case where a patch and its > counterpart have the same patch-id ? Certainly it could. My point was only that it doesn't currently (and it does not even know what the counterpart is, only that there is one). > Also maybe git-rebase should warn when dropping a commit having a note > to tell the user that the note is dropped too. That might end up annoying, depending on what you use notes for. But I think if it were restricted to notes that would be rewritten via notes.rewriteRef, it probably makes sense. Patches welcome. -Peff ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-04 8:49 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-04 7:51 Transfer notes when rebasing Francis Moreau 2013-09-04 7:53 ` Jeff King 2013-09-04 7:59 ` John Keeping 2013-09-04 8:03 ` Francis Moreau 2013-09-04 8:28 ` Jeff King 2013-09-04 8:47 ` Francis Moreau 2013-09-04 8:49 ` Jeff King
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).