* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 [not found] ` <56EB9B0C.4050507@nvidia.com> @ 2016-03-18 7:15 ` Linus Torvalds 2016-03-18 14:32 ` Johannes Schindelin 0 siblings, 1 reply; 7+ messages in thread From: Linus Torvalds @ 2016-03-18 7:15 UTC (permalink / raw) To: Laxman Dewangan, Junio C Hamano Cc: Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List On Thu, Mar 17, 2016 at 11:07 PM, Laxman Dewangan <ldewangan@nvidia.com> wrote: > > For creating the repo and branch, I just followed the instruction from wiki > https://help.github.com/articles/create-a-repo/ So you shouldn't have created a new repo at all, you should just have cloned an existing one (that gets you a repo, of course). You basically ended up starting a new project. But I guess the github connection explains why there was a crazy README.md file there, and I can see why that documentation would make you think it's the right thing to do. Oh well. Just a "git init" wouldn't have done that kind of damage, the github documentation is just misleading in this respect. We may have to make it really really really clear for the kernel that people should not use github in any way except purely for hosting.. > I jut use git (git version 2.1.4) for pushing the changes in github repo. > > There is no other tools used. I thought git didn't merge two branches that have no common base by default, but it seems it will happily do so. So once you made the mistake of starting a new project, git merge ended up "helpfully" allowing you to merge the remote tracking branch into that new project, and we ended up with a silly new root. "git pull-request" will complain about not having a commit in common, but "git merge" apparently does not even warn. Adding Junio and the git list. This seems like much too easy a way to screw up. Junio (and git people), the problem is that github seems to have caused Laxman to think he should start a new project, and then git happily merged the new root just because nobody knew better. And sadly, I didn't notice the history screw-up until too late, so now we in the kernel have a third root commit (the first two are intentional): commit a101ad945113 was merged by commit e5451c8f8330. So how about a patch something like this: --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1398,7 +1398,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) NULL, 0, UPDATE_REFS_DIE_ON_ERR); if (remoteheads && !common) - ; /* No common ancestors found. We need a real merge. */ + die(_("No common ancestor - not merging")); else if (!remoteheads || (!remoteheads->next && !common->next && common->item == remoteheads->item)) { (the above is explicitly whitespace-damaged on purpose - it's not meant as a serious patch, because we do want the *ability* to merge different projects across different roots, and there are even git tests for it, it's just that I think it's too easy to make this mistake and not even realize). So the real thing having a special option required to merge non-related projects? Or at least a humongous warning? You can recreate (for testing only!) this by doing this in a kernel repo: git checkout a101ad945113 git merge 3cf42efc3479 and you'll see how it happily ends up creating a merge commit with no common ancestors and no warning that anything might be wrong. It will take a while - walking all the way up to the root to not find the common object - but it will happily merge those two totally unrelated branches without complaining at all. Now I'm starting to wonder just how many github projects have lots of separate root commits.. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 7:15 ` [GIT PULL] GPIO bulk changes for kernel v4.6 Linus Torvalds @ 2016-03-18 14:32 ` Johannes Schindelin 2016-03-18 15:43 ` Junio C Hamano 2016-03-18 15:47 ` Linus Torvalds 0 siblings, 2 replies; 7+ messages in thread From: Johannes Schindelin @ 2016-03-18 14:32 UTC (permalink / raw) To: Linus Torvalds Cc: Laxman Dewangan, Junio C Hamano, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List Hi Linus, On Fri, 18 Mar 2016, Linus Torvalds wrote: > I thought git didn't merge two branches that have no common base by > default, but it seems it will happily do so. What happened to "The coolest merge EVER!"? http://thread.gmane.org/gmane.comp.version-control.git/5126/ Ciao, Dscho ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 14:32 ` Johannes Schindelin @ 2016-03-18 15:43 ` Junio C Hamano 2016-03-18 15:47 ` Linus Torvalds 1 sibling, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2016-03-18 15:43 UTC (permalink / raw) To: Johannes Schindelin Cc: Linus Torvalds, Laxman Dewangan, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > Hi Linus, > > On Fri, 18 Mar 2016, Linus Torvalds wrote: > >> I thought git didn't merge two branches that have no common base by >> default, but it seems it will happily do so. > > What happened to "The coolest merge EVER!"? > > http://thread.gmane.org/gmane.comp.version-control.git/5126/ > > Ciao, > Dscho An obvious response to the above, "What about it?", is something you would have already anticipated when you wrote the above, and I wish I saw that in the message I am responding to, but I didn't, so here is my attempt ;-) The old article shows two interesting things. One is that there are cases where it makes perfect sense to bind two unrelated histories when the two roots are totally unrelated. I am not Linus, but I think the proposal is to make it harder to do this unusual merge by mistake, while keeping it possible to do so when the user really wants to. And the "deliberately whitespace damaged patch" in the message you are responding to was primarily to point out where the "making it harder" logic should go by showing how to make it impossible, leaving it to readers to adjust it to "harder but still possible". Now, the second thing that the old article you pointed shows is that it is possible to create such a merge without using "git merge" even though it is more involved and takes conscious effort by the user. In that sense, you could argue that, with the "make it impossible" change in Linus's message to "git merge", there is no more change needed (I do not know if that is what you meant to imply, though). I think it makes sense to teach "git merge" to error out like Linus did unless the user explicitly says "I know what I am doing" with an explicit option (e.g. --force or --merge-unrelated-histories). ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 14:32 ` Johannes Schindelin 2016-03-18 15:43 ` Junio C Hamano @ 2016-03-18 15:47 ` Linus Torvalds 2016-03-18 16:37 ` Junio C Hamano 1 sibling, 1 reply; 7+ messages in thread From: Linus Torvalds @ 2016-03-18 15:47 UTC (permalink / raw) To: Johannes Schindelin Cc: Laxman Dewangan, Junio C Hamano, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List On Fri, Mar 18, 2016 at 7:32 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > On Fri, 18 Mar 2016, Linus Torvalds wrote: > >> I thought git didn't merge two branches that have no common base by >> default, but it seems it will happily do so. > > What happened to "The coolest merge EVER!"? > > http://thread.gmane.org/gmane.comp.version-control.git/5126/ I'm not complaining about multi-root capability in general - it's still cool. In the kernel, we have aef8755711a2 ("Merge Btrfs into fs/btrfs") that does something slightly similar. It's literally just the fact that "git merge" does it with no extra flags or checks. I'd like people to have to be aware of what they are doing when they merge two different projects, not do it by mistake. So making it conditional on a flag like "--no-common-root" is what I'd look for. Or just make it about the merge stategy. For example, "subtree" makes sense exactly for merging one project into a subdirectory of another. But the default merge shouldn't do it. I don't think the original "resolve" did it, for example. You can't do a three-way merge without a base. Note how that above "coolest merge" definitely wasn't done by just "git merge gitk". I had to play around with the git internals. Now, it shouldn't be _that_ hard, but at the same time it really shouldn't be as easy as "I didn't know, so I merged two independent projects". Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 15:47 ` Linus Torvalds @ 2016-03-18 16:37 ` Junio C Hamano 2016-03-18 17:01 ` Linus Torvalds 0 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2016-03-18 16:37 UTC (permalink / raw) To: Linus Torvalds Cc: Johannes Schindelin, Laxman Dewangan, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List Linus Torvalds <torvalds@linux-foundation.org> writes: > It's literally just the fact that "git merge" does it with no extra > flags or checks. I'd like people to have to be aware of what they are > doing when they merge two different projects, not do it by mistake. > > So making it conditional on a flag like "--no-common-root" is what I'd look for. I think I said essentially the same thing in a separate message; I am not sure "--no-common-root" is a good name, but I think it is better to be more explicit than tying this to a strategy. > I don't think the original "resolve" did it, for example. You can't do > a three-way merge without a base. Yes, and that continues to this day: # Give up if we are given two or more remotes -- not handling octopus. case "$remotes" in ?*' '?*) exit 2 ;; esac # Give up if this is a baseless merge. if test '' = "$bases" then exit 2 fi This is a tangent but I wonder if we should say why we refuse to the standard error before calling these two "exit"s. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 16:37 ` Junio C Hamano @ 2016-03-18 17:01 ` Linus Torvalds 2016-03-18 17:16 ` Junio C Hamano 0 siblings, 1 reply; 7+ messages in thread From: Linus Torvalds @ 2016-03-18 17:01 UTC (permalink / raw) To: Junio C Hamano Cc: Johannes Schindelin, Laxman Dewangan, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List On Fri, Mar 18, 2016 at 9:37 AM, Junio C Hamano <gitster@pobox.com> wrote: > >> I don't think the original "resolve" did it, for example. You can't do >> a three-way merge without a base. > > Yes, and that continues to this day: Yeah, "octopus" also refuses it cleanly: common=$(git merge-base --all $SHA1 $MRC) || die "Unable to find common commit with $pretty_name" The code in the recursive merge that allows this to happen is this: if (merged_common_ancestors == NULL) { /* if there is no common ancestor, use an empty tree */ struct tree *tree; tree = lookup_tree(EMPTY_TREE_SHA1_BIN); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); } so the "no common ancestors" is just considered to be an empty merge base. And I do think that's right, and I think it's clever, and it goes back to 2006: 934d9a24078e merge-recur: if there is no common ancestor, fake empty one but I think there should be an option there. > This is a tangent but I wonder if we should say why we refuse to > the standard error before calling these two "exit"s. As mentioned, Octopus does. That said, there's probably no reason to ever use the old three-way merge, so I'm not even sure it's worth fixing the old git-merge-resolve. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [GIT PULL] GPIO bulk changes for kernel v4.6 2016-03-18 17:01 ` Linus Torvalds @ 2016-03-18 17:16 ` Junio C Hamano 0 siblings, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2016-03-18 17:16 UTC (permalink / raw) To: Linus Torvalds Cc: Johannes Schindelin, Laxman Dewangan, Linus Walleij, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Git Mailing List Linus Torvalds <torvalds@linux-foundation.org> writes: > The code in the recursive merge that allows this to happen is this: > ... > And I do think that's right, and I think it's clever, and it goes back to 2006: > > 934d9a24078e merge-recur: if there is no common ancestor, fake empty one > > but I think there should be an option there. Oh, I think everybody understands that and agrees by now. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-18 17:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CACRpkdbGkfJ9bW1db64msMeQjue+=y+op5EmSx62FWOWDOJwWg@mail.gmail.com>
[not found] ` <CA+55aFwV4Cq=4zJc6Fw0yAGrTmci_DFAjJKxkk05pjJJf3iYbA@mail.gmail.com>
[not found] ` <56EB9B0C.4050507@nvidia.com>
2016-03-18 7:15 ` [GIT PULL] GPIO bulk changes for kernel v4.6 Linus Torvalds
2016-03-18 14:32 ` Johannes Schindelin
2016-03-18 15:43 ` Junio C Hamano
2016-03-18 15:47 ` Linus Torvalds
2016-03-18 16:37 ` Junio C Hamano
2016-03-18 17:01 ` Linus Torvalds
2016-03-18 17:16 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox