{"thread":{"id":"36152","subject":"Proposal: Write git subtree info to .git/config","startedAt":"2014-03-13T23:18:42Z","lastAt":"2014-03-14T00:46:37Z","messageCount":4,"participants":["John Butterfield","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"236697","messageId":"CAJ2ZDL+HuBCv_xJCXEBb3Pex-qt86ocEX9yu=uV+CzdvqwECDA@mail.gmail.com","threadId":"36152","inReplyTo":null,"subject":"Proposal: Write git subtree info to .git/config","fromName":"John Butterfield","fromEmail":"johnb003@gmail.com","sentAt":"2014-03-13T23:18:42Z","receivedAt":"2014-03-13T23:18:42Z","isPatch":false,"sender":{"key":"johnb003@gmail.com","avatar":"https://gravatar.com/avatar/12e69311abb548868d1d8188171b4bf513c9726624dc83e5e8a24e61d5f3159d?d=mp&s=160"},"body":"Has there been any talk about adding a stub for git subtrees in .git/config?\n\nThe primary benefits would be:\n\n1. Determine what sub directories of the project were at one time\npulled from another repo (where from and which commit id), without\nhaving to attempt to infer this by scanning the log.\n2. Simplify command syntax by providing a predictable default (ie.\nlast pulled from, last pushed to), and not requiring the repo argument\noptional.\n3. Improvement for default commit id to start split operations over\nusing --rejoin which creates blank log entries just so the log scan\ncan find it (afaict). It's a default either way, so it can still\nalways be explicitly specified.\n\nIf this information were available in the config, I think additional\nfeatures could be added as well:\n\n- The command 'git subtree pull' for instance could be made to pull\n*all* subtrees, similar to the way 'git submodule update' works.\n- An option -i (interactive), or -p (prompt), etc. could be added that\nconfirms the defaults read from the config before actually executing\nthe command with implicit arguments, and the ability to modify the\narguments before the command actually executes.\n- If the current working directory from which the command is run\nhappens to be a subtree specified in the config, the --prefix could\neven be implied.\n\n\nNone of these ideas would break the way the command currently works\nsince it can still always take explicit arguments. There's a comment\nin the documentation about the command that says:\n\n> Unlike submodules, subtrees do not need any special constructions (like .gitmodule files or gitlinks) be present in your repository\n\nIt would still be true that subtrees do not *need* any special config\nsettings, but that doesn't mean they are bad, and by having them the\ncommand could be improved and made easier to use.\n\nI'm happy to contribute the changes myself if this proposal is acceptable.\n"},{"id":"236699","messageId":"xmqqmwgthdsp.fsf@gitster.dls.corp.google.com","threadId":"36152","inReplyTo":"CAJ2ZDL+HuBCv_xJCXEBb3Pex-qt86ocEX9yu=uV+CzdvqwECDA@mail.gmail.com","subject":"Re: Proposal: Write git subtree info to .git/config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-13T23:36:06Z","receivedAt":"2014-03-13T23:36:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Butterfield <johnb003@gmail.com> writes:\n\n> Has there been any talk about adding a stub for git subtrees in .git/config?\n\nI do not think so, and that is probably for a good reason.\n\nA subtree biding can change over time, but .git/config is about\nrecording information that do not change depending on what tree you\nare looking at, so there is an impedance mismatch---storing that\ninformation in .git/config is probably a wrong way to go about it.\n\nIt might help to keep track of \"In this tree, the tip of that other\nhistory is bound as a subtree at this path\", which means that\ninformation more naturally belongs to each tree, I would think.\n"},{"id":"236702","messageId":"CAJ2ZDLK2wGJ5PG585dQRmp7Ck9bctRRtz1unwQ9S0OfVe8G-Bg@mail.gmail.com","threadId":"36152","inReplyTo":"xmqqmwgthdsp.fsf@gitster.dls.corp.google.com","subject":"Re: Proposal: Write git subtree info to .git/config","fromName":"John Butterfield","fromEmail":"johnb003@gmail.com","sentAt":"2014-03-14T00:43:38Z","receivedAt":"2014-03-14T00:43:38Z","isPatch":false,"sender":{"key":"johnb003@gmail.com","avatar":"https://gravatar.com/avatar/12e69311abb548868d1d8188171b4bf513c9726624dc83e5e8a24e61d5f3159d?d=mp&s=160"},"body":"> A subtree biding can change over time, but .git/config is about\nrecording information that do not change depending on what tree you\nare looking at, so there is an impedance mismatch---storing that\ninformation in .git/config is probably a wrong way to go about it.\n\nI see. How about a .gitsubtrees config file in the root of a project?\n\n> It might help to keep track of \"In this tree, the tip of that other\nhistory is bound as a subtree at this path\", which means that\ninformation more naturally belongs to each tree, I would think.\n\nAnything in the subdirectory must be part of the contents of the\nsubtree repo. It should not know how it is linked to it's parent\nproject; parents should know how their children are fetched. Therefore\nit cannot live in the subtree.\n\nSubtrees could be nested. So, should the config be in the root of the\nparent subtree? This makes sense to me.\n\nExample:\n\n/\n  A/\n  B/    # a subtree of (blah)\n    X/\n    Y/  # a subtree of (yada-yada)\n    Z/\n\nSo, lets say B has many updates remotely, including pushing and\npulling changes to Y.\n\nWhen pulling the changes from B, it would be convenient for it to come\nwith the meta data, (subtree repo and commit info) for Y.\n\nSo how does that sound; Could we store subtree repo and commit id\nreferences per folder in a .gitsubtrees file in the root of every\nproject?\n\n(Project B is technically it's own project so it would pull it's own\n.gitsubtrees in /B/.gitsubtrees)\n\n`John\n\nOn Thu, Mar 13, 2014 at 4:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> John Butterfield <johnb003@gmail.com> writes:\n>\n>> Has there been any talk about adding a stub for git subtrees in .git/config?\n>\n> I do not think so, and that is probably for a good reason.\n>\n> A subtree biding can change over time, but .git/config is about\n> recording information that do not change depending on what tree you\n> are looking at, so there is an impedance mismatch---storing that\n> information in .git/config is probably a wrong way to go about it.\n>\n> It might help to keep track of \"In this tree, the tip of that other\n> history is bound as a subtree at this path\", which means that\n> information more naturally belongs to each tree, I would think.\n"},{"id":"236703","messageId":"CAJ2ZDLJtp0Nz-HSyX8DWn96qj=J6Snvx8fKfSNg3qdbmj0=4nA@mail.gmail.com","threadId":"36152","inReplyTo":"CAJ2ZDLK2wGJ5PG585dQRmp7Ck9bctRRtz1unwQ9S0OfVe8G-Bg@mail.gmail.com","subject":"Re: Proposal: Write git subtree info to .git/config","fromName":"John Butterfield","fromEmail":"johnb003@gmail.com","sentAt":"2014-03-14T00:46:37Z","receivedAt":"2014-03-14T00:46:37Z","isPatch":false,"sender":{"key":"johnb003@gmail.com","avatar":"https://gravatar.com/avatar/12e69311abb548868d1d8188171b4bf513c9726624dc83e5e8a24e61d5f3159d?d=mp&s=160"},"body":"by \"per folder\" I meant, \"for each subtree\"\n\nOn Thu, Mar 13, 2014 at 5:43 PM, John Butterfield <johnb003@gmail.com> wrote:\n>> A subtree biding can change over time, but .git/config is about\n> recording information that do not change depending on what tree you\n> are looking at, so there is an impedance mismatch---storing that\n> information in .git/config is probably a wrong way to go about it.\n>\n> I see. How about a .gitsubtrees config file in the root of a project?\n>\n>> It might help to keep track of \"In this tree, the tip of that other\n> history is bound as a subtree at this path\", which means that\n> information more naturally belongs to each tree, I would think.\n>\n> Anything in the subdirectory must be part of the contents of the\n> subtree repo. It should not know how it is linked to it's parent\n> project; parents should know how their children are fetched. Therefore\n> it cannot live in the subtree.\n>\n> Subtrees could be nested. So, should the config be in the root of the\n> parent subtree? This makes sense to me.\n>\n> Example:\n>\n> /\n>   A/\n>   B/    # a subtree of (blah)\n>     X/\n>     Y/  # a subtree of (yada-yada)\n>     Z/\n>\n> So, lets say B has many updates remotely, including pushing and\n> pulling changes to Y.\n>\n> When pulling the changes from B, it would be convenient for it to come\n> with the meta data, (subtree repo and commit info) for Y.\n>\n> So how does that sound; Could we store subtree repo and commit id\n> references per folder in a .gitsubtrees file in the root of every\n> project?\n>\n> (Project B is technically it's own project so it would pull it's own\n> .gitsubtrees in /B/.gitsubtrees)\n>\n> `John\n>\n> On Thu, Mar 13, 2014 at 4:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> John Butterfield <johnb003@gmail.com> writes:\n>>\n>>> Has there been any talk about adding a stub for git subtrees in .git/config?\n>>\n>> I do not think so, and that is probably for a good reason.\n>>\n>> A subtree biding can change over time, but .git/config is about\n>> recording information that do not change depending on what tree you\n>> are looking at, so there is an impedance mismatch---storing that\n>> information in .git/config is probably a wrong way to go about it.\n>>\n>> It might help to keep track of \"In this tree, the tip of that other\n>> history is bound as a subtree at this path\", which means that\n>> information more naturally belongs to each tree, I would think.\n"}]}