Re: Subtree split unsquashes everything

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

 



Joseph Musser <me@xxxxxxxx> writes:

> I ran `git subtree split -P=subdir/subdir/ -b newbranch` and the
> outcome seems to be perfect except that each squash merge has turned
> into a full merge, bringing along all history from the other repo. Why
> does it do this and how can I preserve my repo history, including only
> squashes from the subtree remote repo like it is today?

The only thing that --squash does on an add/merge/pull is a read-tree of
the fetched commit into a new commit in the host repository which is
then merged in to the host repository's branch.  It also annotates the
hash of the original commit in the git-subtree-split metadata.

As the split code processes commits it records parents to link up the
history to that in the subtree's original repository.  Crucially, the
git-subtree-split metadata of the commit message git-subtree creates for
squashes lists the original commit ID of the squashd commit.  That lets
git-subtree hook up split commits back to the original project history.
I believe that's why the split branch is showing the full history.  It's
baked into the split algorithm.

Presumably you split the subdirectory from the same working repository
in which you added the subtree commits in the first place.  Thus the
history of the original project is all there (it was fetched when the
subtree was added/merged).  I have not tested this, but I wonder what
would happen if you either deleted that history from the host repository
or you cloned the host repository to a new place and tried the split
there.  The original hisory wouldn't be there and git-subtree would not
have it to hook up to.

I have mentioned before that I'm working on a complete overhaul of the
split code.  Since git-subtree split it typically used to send commits
back to the original subtree repository, I never imagined that someone
would *not* want to get the original history back.  If the squash were
not reversed we would not be able to merge the history back in to the
original repository.  If keeping squashes is truly desired I will have
to think about how to do that, likely as a non-default option to split
or even an entirely different command.

                      -David
--
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]