git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Proposal: Write git subtree info to .git/config
@ 2014-03-13 23:18 John Butterfield
  2014-03-13 23:36 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: John Butterfield @ 2014-03-13 23:18 UTC (permalink / raw)
  To: git

Has there been any talk about adding a stub for git subtrees in .git/config?

The primary benefits would be:

1. Determine what sub directories of the project were at one time
pulled from another repo (where from and which commit id), without
having to attempt to infer this by scanning the log.
2. Simplify command syntax by providing a predictable default (ie.
last pulled from, last pushed to), and not requiring the repo argument
optional.
3. Improvement for default commit id to start split operations over
using --rejoin which creates blank log entries just so the log scan
can find it (afaict). It's a default either way, so it can still
always be explicitly specified.

If this information were available in the config, I think additional
features could be added as well:

- The command 'git subtree pull' for instance could be made to pull
*all* subtrees, similar to the way 'git submodule update' works.
- An option -i (interactive), or -p (prompt), etc. could be added that
confirms the defaults read from the config before actually executing
the command with implicit arguments, and the ability to modify the
arguments before the command actually executes.
- If the current working directory from which the command is run
happens to be a subtree specified in the config, the --prefix could
even be implied.


None of these ideas would break the way the command currently works
since it can still always take explicit arguments. There's a comment
in the documentation about the command that says:

> Unlike submodules, subtrees do not need any special constructions (like .gitmodule files or gitlinks) be present in your repository

It would still be true that subtrees do not *need* any special config
settings, but that doesn't mean they are bad, and by having them the
command could be improved and made easier to use.

I'm happy to contribute the changes myself if this proposal is acceptable.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Proposal: Write git subtree info to .git/config
  2014-03-13 23:18 Proposal: Write git subtree info to .git/config John Butterfield
@ 2014-03-13 23:36 ` Junio C Hamano
  2014-03-14  0:43   ` John Butterfield
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2014-03-13 23:36 UTC (permalink / raw)
  To: John Butterfield; +Cc: git

John Butterfield <johnb003@gmail.com> writes:

> Has there been any talk about adding a stub for git subtrees in .git/config?

I do not think so, and that is probably for a good reason.

A subtree biding can change over time, but .git/config is about
recording information that do not change depending on what tree you
are looking at, so there is an impedance mismatch---storing that
information in .git/config is probably a wrong way to go about it.

It might help to keep track of "In this tree, the tip of that other
history is bound as a subtree at this path", which means that
information more naturally belongs to each tree, I would think.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Proposal: Write git subtree info to .git/config
  2014-03-13 23:36 ` Junio C Hamano
@ 2014-03-14  0:43   ` John Butterfield
  2014-03-14  0:46     ` John Butterfield
  0 siblings, 1 reply; 4+ messages in thread
From: John Butterfield @ 2014-03-14  0:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

> A subtree biding can change over time, but .git/config is about
recording information that do not change depending on what tree you
are looking at, so there is an impedance mismatch---storing that
information in .git/config is probably a wrong way to go about it.

I see. How about a .gitsubtrees config file in the root of a project?

> It might help to keep track of "In this tree, the tip of that other
history is bound as a subtree at this path", which means that
information more naturally belongs to each tree, I would think.

Anything in the subdirectory must be part of the contents of the
subtree repo. It should not know how it is linked to it's parent
project; parents should know how their children are fetched. Therefore
it cannot live in the subtree.

Subtrees could be nested. So, should the config be in the root of the
parent subtree? This makes sense to me.

Example:

/
  A/
  B/    # a subtree of (blah)
    X/
    Y/  # a subtree of (yada-yada)
    Z/

So, lets say B has many updates remotely, including pushing and
pulling changes to Y.

When pulling the changes from B, it would be convenient for it to come
with the meta data, (subtree repo and commit info) for Y.

So how does that sound; Could we store subtree repo and commit id
references per folder in a .gitsubtrees file in the root of every
project?

(Project B is technically it's own project so it would pull it's own
.gitsubtrees in /B/.gitsubtrees)

`John

On Thu, Mar 13, 2014 at 4:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
> John Butterfield <johnb003@gmail.com> writes:
>
>> Has there been any talk about adding a stub for git subtrees in .git/config?
>
> I do not think so, and that is probably for a good reason.
>
> A subtree biding can change over time, but .git/config is about
> recording information that do not change depending on what tree you
> are looking at, so there is an impedance mismatch---storing that
> information in .git/config is probably a wrong way to go about it.
>
> It might help to keep track of "In this tree, the tip of that other
> history is bound as a subtree at this path", which means that
> information more naturally belongs to each tree, I would think.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Proposal: Write git subtree info to .git/config
  2014-03-14  0:43   ` John Butterfield
@ 2014-03-14  0:46     ` John Butterfield
  0 siblings, 0 replies; 4+ messages in thread
From: John Butterfield @ 2014-03-14  0:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

by "per folder" I meant, "for each subtree"

On Thu, Mar 13, 2014 at 5:43 PM, John Butterfield <johnb003@gmail.com> wrote:
>> A subtree biding can change over time, but .git/config is about
> recording information that do not change depending on what tree you
> are looking at, so there is an impedance mismatch---storing that
> information in .git/config is probably a wrong way to go about it.
>
> I see. How about a .gitsubtrees config file in the root of a project?
>
>> It might help to keep track of "In this tree, the tip of that other
> history is bound as a subtree at this path", which means that
> information more naturally belongs to each tree, I would think.
>
> Anything in the subdirectory must be part of the contents of the
> subtree repo. It should not know how it is linked to it's parent
> project; parents should know how their children are fetched. Therefore
> it cannot live in the subtree.
>
> Subtrees could be nested. So, should the config be in the root of the
> parent subtree? This makes sense to me.
>
> Example:
>
> /
>   A/
>   B/    # a subtree of (blah)
>     X/
>     Y/  # a subtree of (yada-yada)
>     Z/
>
> So, lets say B has many updates remotely, including pushing and
> pulling changes to Y.
>
> When pulling the changes from B, it would be convenient for it to come
> with the meta data, (subtree repo and commit info) for Y.
>
> So how does that sound; Could we store subtree repo and commit id
> references per folder in a .gitsubtrees file in the root of every
> project?
>
> (Project B is technically it's own project so it would pull it's own
> .gitsubtrees in /B/.gitsubtrees)
>
> `John
>
> On Thu, Mar 13, 2014 at 4:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> John Butterfield <johnb003@gmail.com> writes:
>>
>>> Has there been any talk about adding a stub for git subtrees in .git/config?
>>
>> I do not think so, and that is probably for a good reason.
>>
>> A subtree biding can change over time, but .git/config is about
>> recording information that do not change depending on what tree you
>> are looking at, so there is an impedance mismatch---storing that
>> information in .git/config is probably a wrong way to go about it.
>>
>> It might help to keep track of "In this tree, the tip of that other
>> history is bound as a subtree at this path", which means that
>> information more naturally belongs to each tree, I would think.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-14  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 23:18 Proposal: Write git subtree info to .git/config John Butterfield
2014-03-13 23:36 ` Junio C Hamano
2014-03-14  0:43   ` John Butterfield
2014-03-14  0:46     ` John Butterfield

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).