git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] [git 2.16.1] yeeek ... my files are gone .. by git pull <otherRepositoryUrl>

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 5, 2018, 14:49 UTC
Message-ID
<nycvar.QRO.7.76.6.1803051546200.20700@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
In-Reply-To
<20180228132807.GA6206@sigill.intra.peff.net>
Hi Peff,
On Wed, 28 Feb 2018, Jeff King wrote:
Show 46 quoted lines
> On Tue, Feb 27, 2018 at 12:33:56AM +0100, Johannes Schindelin wrote:
> 
> > > So something like this helps:
> > > 
> > > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> > > index 81c5b42875..71e6cbb388 100644
> > > --- a/git-rebase--interactive.sh
> > > +++ b/git-rebase--interactive.sh
> > > @@ -921,15 +921,20 @@ else
> > >  
> > >  		if test -z "$rebase_root"
> > >  		then
> > >  			preserve=t
> > > +			p=
> > >  			for p in $(git rev-list --parents -1 $sha1 | cut -d' ' -s -f2-)
> > >  			do
> > >  				if test -f "$rewritten"/$p
> > >  				then
> > >  					preserve=f
> > >  				fi
> > >  			done
> > > +			if test -z "$p"
> > > +			then
> > > +				preserve=f
> > > +			fi
> > >  		else
> > >  			preserve=f
> > >  		fi
> > >  		if test f = "$preserve"
> > > 
> > > Because it at least adds "two" to the list of commits to pick. But
> > > oddly, it picks it directly as a root commit again. Whereas a rebase
> > > without --preserve-merges (and even "-i") picks it on top of commit
> > > "one" (which is what I'd expect).
> > > 
> > > +cc Dscho, as the --preserve-merges guru.
> > 
> > Your analysis makes sense to me. Please note, though, that I would not
> > consider myself a guru on preserve-merges. I think this mode is broken by
> > design (you can blame me if you want).
> 
> I think that is doing the right thing for half of the problem. But
> there's something else funny where we do not include the "upstream"
> commits from the split history (i.e., we rebase onto nothing,
> whereas a normal "git rebase" with a split history will graft the two
> together).

Let me ask to make sure I am understanding you correctly. Are you referring to "split history" as the case where the commit graph has *two* root commits?

If so: when you perform a merge-preserving rebase, then those two root commits will be recreated as new root commits, by design.

The non-merge-preserving mode cannot create two root commits, as it does not allow for introducing merge commits (and you'd need that to combine the two strands).

It is quite possible that I misunderstand completely, though. Care to enlighten me?

Ciao, Dscho

Previous: Jeff KingNext: Jeff King
Message 7 of 8 in “[BUG] [git 2.16.1] yeeek ... my files are gone .. by git pull <otherRepositoryUrl>”
  1. Marcel 'childNo͡.de' TrautweinFeb 22, 2018
  2. Jonathan NiederFeb 22, 2018
  3. Marcel 'childNo͡.de' TrautweinFeb 23, 2018
  4. Jeff KingFeb 23, 2018
  5. Johannes SchindelinFeb 26, 2018
  6. Jeff KingFeb 28, 2018
  7. Johannes SchindelinMar 5, 2018
  8. Jeff KingMar 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.