All of lore.kernel.org
 help / color / mirror / Atom feed
* Definition of "the Git repository"
@ 2021-06-25  1:44 Kevin Buckley
  2021-06-25  5:56 ` Ævar Arnfjörð Bjarmason
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Kevin Buckley @ 2021-06-25  1:44 UTC (permalink / raw)
  To: git

Hi there,

raising this on the back of a discussion over at the Software
Carpentry lesson about Git,

    https://github.com/swcarpentry/git-novice/issues/810

I used the book to justify my claim that it is the .git directory
that is the repository, but I do have to concede that the way that
the text in section 2.1 of the book reads, does suggest that one
can refer to the working directory PLUS the .git directory as a
"repository" as well as being able to refer to the .git directory
alone as the "repository".

In the way I think of it

git init

initialises a Git repository, however, the only thing that changes
as a result is that a .git directory has been created, ergo, the
.git directory is the repository.

Furthermore, the fact that one can take the .git directory, move it
to a new directory and start using it there (very much a nice feature)
also suggests to me that it is the .git directory that is the repository,
as distict from a working directory, under Git control because of the
existence of a repository within it.

Interested to hear any thoughts around the semantics here,
Kevin Buckley

-- 
Supercomputing Systems Administrator
Pawsey Supercomputing Centre

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

* Re: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
@ 2021-06-25  5:56 ` Ævar Arnfjörð Bjarmason
  2021-06-25  8:56 ` Igor Djordjevic
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-06-25  5:56 UTC (permalink / raw)
  To: Kevin Buckley; +Cc: git


On Fri, Jun 25 2021, Kevin Buckley wrote:

> Hi there,
>
> raising this on the back of a discussion over at the Software
> Carpentry lesson about Git,
>
>    https://github.com/swcarpentry/git-novice/issues/810
>
> I used the book to justify my claim that it is the .git directory
> that is the repository, but I do have to concede that the way that
> the text in section 2.1 of the book reads, does suggest that one
> can refer to the working directory PLUS the .git directory as a
> "repository" as well as being able to refer to the .git directory
> alone as the "repository".
>
> In the way I think of it
>
> git init
>
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.
>
> Furthermore, the fact that one can take the .git directory, move it
> to a new directory and start using it there (very much a nice feature)
> also suggests to me that it is the .git directory that is the repository,
> as distict from a working directory, under Git control because of the
> existence of a repository within it.
>
> Interested to hear any thoughts around the semantics here,
> Kevin Buckley

I think the right answer to this is that there is no right answer, if
you read gitglossary(7) you'll find it mostly backs your argument, but
you'll also find mentions in git's own documentation that say things
like "a subdirectory of your repository" when referring to the
repository's working tree.

More importantly it seems like this is documentation for novices, I
think it's generally more important to get important notions like their
historical data being stored in that .git thingy than it is to nail down
every concept involved in that with 100% accuracy.

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

* Re: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
  2021-06-25  5:56 ` Ævar Arnfjörð Bjarmason
@ 2021-06-25  8:56 ` Igor Djordjevic
  2021-06-25  9:14 ` Igor Djordjevic
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Igor Djordjevic @ 2021-06-25  8:56 UTC (permalink / raw)
  To: Kevin Buckley, git



On 25/06/2021 03:44, Kevin Buckley wrote:
> 
> raising this on the back of a discussion over at the Software
> Carpentry lesson about Git,
> 
>    https://github.com/swcarpentry/git-novice/issues/810
> 
> I used the book to justify my claim that it is the .git directory
> that is the repository, but I do have to concede that the way that
> the text in section 2.1 of the book reads, does suggest that one
> can refer to the working directory PLUS the .git directory as a
> "repository" as well as being able to refer to the .git directory
> alone as the "repository".
> 
> In the way I think of it
> 
> git init
> 
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.
> 
> Furthermore, the fact that one can take the .git directory, move it
> to a new directory and start using it there (very much a nice feature)
> also suggests to me that it is the .git directory that is the repository,
> as distict from a working directory, under Git control because of the
> existence of a repository within it.
> 
> Interested to hear any thoughts around the semantics here,

Thinking out loud, and without discussing various places where "Git 
repository" might be described one way or the other, a "repository" 
is a place where *something* is *stored*.

"Source code repository" would thus be a place where source code is 
stored, possibly with some metadata (current version, last change, 
etc.), but not necessarily the whole (versioned) history. For storage 
purpose alone, Git's own working tree could be then considered a 
repository in its own right (source code repository, if it contains 
source code, but it could contain other stuff as well, in addition or 
standalone). But as soon as you start working in it it's not really 
(only) a storage anymore (so not a repository), but a working area. 
It's more of a conceptual thing.

So if we strictly speak of "Git repository", I think it should be a 
place where Git keeps (stores) your (committed) work, alongside its 
own (meta)data - and that is the ".git" directory, indeed. Seems 
simple enough :)

One place where the confusion might be extended is the notion of 
"bare repository" for ".git" directory alone (without the working 
tree), which should then imply ".git" + working tree is in fact 
"a repository"... which it is, but bare with me - pun intended :)

As Git is mainly used to version artifacts being more or less actively 
worked on (changing, that is), one needs a working area in order to 
do the actual work, thus we have a working tree happily and conveniently 
provided by Git by default, as part of *working with* a Git repository.

As you said, having ".git" directory alone is enough to recreate the 
contents of the working tree, where if you would have the working tree 
alone, even if that could be considered to be "a repository" (for 
storage, not work), you would definitely not have "a Git repository" 
(no ".git" directory).

Also, when you work with a remote Git repository, it's only the 
committed stuff you can work with - what's inside ".git". You have no 
idea of contents of a working tree (and ideally not knowing if one 
even exists, though that's not always the case, like if you try to 
push to a checked out branch).

For some additional understanding, I guess we can compare "repository" 
with "archive", possibly being a more familiar concept - you can 
store source code somewhere, and that's your archive. You don't work 
on it in there, as then it would not be an archive anymore, but you 
keep it as a backup which you can always retrieve if needed.

If you use ZIP to compress your archive, it's then a "ZIP archive". 
And for the most of the time these two would in fact be interchangeable 
- you can have one or the other, being able to recreate one from the 
other (unlike with ".git" and working tree).

BUT, if you add some additional (meta)data to your ZIP archive - like 
password, description, etc. - then the two are not interchangeable 
anymore, "ZIP archive" not being the same as "archive", not being able 
to be recreated from it.

To conclude - Git's concept of a "working tree" alone could be "a 
repository" (used for storage, not working), but it's not "a Git 
repository" without the ".git" directory in it. On the other hand, 
while "Git repository" must have a ".git" directory, it can have a 
"working tree", too - but it doesn't need to (called "bare [Git] 
repository" in such a case), as it can be completely recreated from 
".git" directory alone, being a mere convenience in order to be able 
to do the actual (development) work (and not required for "Git 
repository" to be a "repository").

Finally, as "Git repository" could be referred to as only a 
"repository" for brevity (which it is, in general), it's important to 
notice the latter might be ambiguous (as it does not imply "Git 
repository" in particular), thus using "Git repository" when being in 
the clear is paramount, indicating that you're interested in ".git" 
directory precisely (and possibly, but not necessarily the working 
tree as well). If interested in ".git" directory alone, "bare Git 
repository" is the most precise term.

Regards, Buga

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

* Re: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
  2021-06-25  5:56 ` Ævar Arnfjörð Bjarmason
  2021-06-25  8:56 ` Igor Djordjevic
@ 2021-06-25  9:14 ` Igor Djordjevic
  2021-06-25 19:39 ` Felipe Contreras
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Igor Djordjevic @ 2021-06-25  9:14 UTC (permalink / raw)
  To: Kevin Buckley, git

On 25/06/2021 03:44, Kevin Buckley wrote:
> 
> In the way I think of it
> 
> git init
> 
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.

Another way to look at it could be that you possibly have a repository 
already, and `git init` only makes it a Git repository... ;)

Joking aside, for a looong train of thoughts, see that other reply[1].

Regards, Buga

[1]: https://lore.kernel.org/git/9099ab09-f6d0-f1e2-1b8e-a55d22a903c5@gmail.com/

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

* RE: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
                   ` (2 preceding siblings ...)
  2021-06-25  9:14 ` Igor Djordjevic
@ 2021-06-25 19:39 ` Felipe Contreras
  2021-06-25 20:48 ` Philip Oakley
  2021-06-29  6:59 ` Junio C Hamano
  5 siblings, 0 replies; 15+ messages in thread
From: Felipe Contreras @ 2021-06-25 19:39 UTC (permalink / raw)
  To: Kevin Buckley, git

Kevin Buckley wrote:
> In the way I think of it
> 
> git init
> 
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.

That's not necessarily true. Another way to look at it is that the Git
repository lives inside the .git directory, but not everything inside
that directory is necessarily part of the repository.

I do have plenty of stuff that isn't part of the repository inside the
.git directory.

The easiest way to disprove that hypothesis is finding something inside
.git that isn't part of the repository, and that's easily done:

  .git/index

-- 
Felipe Contreras

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

* Re: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
                   ` (3 preceding siblings ...)
  2021-06-25 19:39 ` Felipe Contreras
@ 2021-06-25 20:48 ` Philip Oakley
  2021-06-28  2:24   ` Kevin Buckley
  2021-06-29  6:59 ` Junio C Hamano
  5 siblings, 1 reply; 15+ messages in thread
From: Philip Oakley @ 2021-06-25 20:48 UTC (permalink / raw)
  To: Kevin Buckley, git

Hi Kevin,

On 25/06/2021 02:44, Kevin Buckley wrote:
> Hi there,
>
> raising this on the back of a discussion over at the Software
> Carpentry lesson about Git,
>
>    https://github.com/swcarpentry/git-novice/issues/810
>
> I used the book to justify my claim that it is the .git directory
> that is the repository, but I do have to concede that the way that
> the text in section 2.1 of the book reads, does suggest that one
> can refer to the working directory PLUS the .git directory as a
> "repository" as well as being able to refer to the .git directory
> alone as the "repository".
>
> In the way I think of it
>
> git init
>
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.
>
> Furthermore, the fact that one can take the .git directory, move it
> to a new directory and start using it there (very much a nice feature)
> also suggests to me that it is the .git directory that is the repository,
> as distict from a working directory, under Git control because of the
> existence of a repository within it.
>
> Interested to hear any thoughts around the semantics here,

In general, the Git semantics are confusing.

There is the generic, the conceptual and the implementation, all of the
same term which has to be understood in context (which again uses terms
with the same multi-way context..). This leapfrogging from concept to
implementation and back again causes lots of learner confusion.

You have already seen that a source directory can become a repository by
being initialised, and that the primary artefacts are in the .git
sub-directory. One can also include in the generic 'repository' the
various special .git* files that are [user] added to the main source
directory.

But it gets worse. In the .git directory there is the 'objects'
directory which actually holds all the _content_ of the 'repository',
each object named by its hash value. This object store is a superset of
those objects that form the versioned repository structure (the 'DAG'),
and other parts of Git, such as the staging area (Index) contents, and
other temporary copies of 'stuff'.

Meanwhile, to make the repository structure work, there are 'branch'
pointers (see 'ref/heads' [0]) to the specific object hashes that
provide the _starting point_ for each branch's linked list of commits
and their content.

The use of the write-once unique object hash names [1] is part of that
implementation 'trickery' that allows Git to work so well, but helps
confuse those who think the object store is synonymous with the
repository (e.g. all the new learners..).

In summary, everyone is right, as long as they are clear about the
context. Which they rarely are.

Philip

[0] the 'ref name's are just strings that conveniently look just like
posix paths ...
[1] the current hash is the 160 bit sha1, so roughly 1 : 10^24  chance
of a collision - unique enough;-)

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

* Re: Definition of "the Git repository"
  2021-06-25 20:48 ` Philip Oakley
@ 2021-06-28  2:24   ` Kevin Buckley
  2021-06-28  3:24     ` Felipe Contreras
  2021-06-28 15:18     ` Philip Oakley
  0 siblings, 2 replies; 15+ messages in thread
From: Kevin Buckley @ 2021-06-28  2:24 UTC (permalink / raw)
  To: git

On 2021/06/26 04:48, Philip Oakley wrote:
>
> ... One can also include in the generic 'repository' the
> various special .git* files that are [user] added to the main source
> directory.
> 
> But it gets worse. In the .git directory there is the 'objects' ...

I don't believe it does get worse, indeed, I am not convinced that it
is as bad as your observation on the semantics might suggest.

Everything within the .git directory "belongs", in my way of thinking,
to the "repository", that is, the directory that gets created when git
is (init)ialised.

For me, the 'objects", the 'ref/heads', the "staging area' and the like,
also lie within the repository.

As for any anciliary files, that control how the git commands actually
process any data in the "working directory" beyond the defaults, some
of them, eg the global commands, will typically exist outside of the
working directory: below one's home directory, and, of course, there
are the system-wide files, typically below /etc.

Given then, that we can have Git-related files, for any given working
directory, below /etc, below the user's home directory, and within the
working directory itself, perhaps it is the whole "computer" which
should be referred to as "the repository"?

Furthermore, even in the case of anciliary files typically found within
the working directory, and I'm thinking of .gitignore as the obvious
example, even the directives in that can be overriden on the command
line, as well as complemented by files outside of the working directory.


I am tempted to say that even if the definition of a "repository" can't
be agreed on, or rather, easily determined by inspection, then at least
the corresponding working directory can be, however, the fact that one
has  access to EnvVars and corresponding command line arguments such as
--git-dir=<path>, --work-tree=<path>, would suggest that it could be
harder for the novice to get their head around things, however, as it is
typicaly clear what the working directory is (the top level directory
containing the files you are working on, under the control of Git),
calling that same directory the "repository" seems, to me anyway, to add
to any confusion, that a Git novice may have.

Given the can of worms that this question has opened up, although I'm
getting the feeling that it has long since been opened, I still maintain
that it would be less confusing, at least for a novice, for the working
directory to be identified and for a previously non-existent directory,
that gets created by the 'git init', to be referred to as the repository,
so as to make a distinction.

Kevin

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

* Re: Definition of "the Git repository"
  2021-06-28  2:24   ` Kevin Buckley
@ 2021-06-28  3:24     ` Felipe Contreras
  2021-06-28  4:00       ` Kevin Buckley
  2021-06-28 15:18     ` Philip Oakley
  1 sibling, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2021-06-28  3:24 UTC (permalink / raw)
  To: Kevin Buckley, git

Kevin Buckley wrote:

> Everything within the .git directory "belongs", in my way of thinking,
> to the "repository", that is, the directory that gets created when git
> is (init)ialised.
> 
> For me, the 'objects", the 'ref/heads', the "staging area' and the like,
> also lie within the repository.

Does it?

Suppose you have three directories, each with exactly the same contents
in their corresponding .git directory, the only difference is the
.git/index file:

 a) No .git/index file at all
 b) The .git/index file doesn't have anything staged
 c) The .git/index file contains some staged changes

Do you really consider them three different repositories?

In my mind the staging area is where you put stuff in preparation for
the commit. The commit is part of the repository, the staging area
isn't.

-- 
Felipe Contreras

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

* Re: Definition of "the Git repository"
  2021-06-28  3:24     ` Felipe Contreras
@ 2021-06-28  4:00       ` Kevin Buckley
  2021-06-28  5:21         ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Kevin Buckley @ 2021-06-28  4:00 UTC (permalink / raw)
  To: git

On 2021/06/28 11:24, Felipe Contreras wrote:
> Kevin Buckley wrote:
> 
>> Everything within the .git directory "belongs", in my way of thinking,
>> to the "repository", that is, the directory that gets created when git
>> is (init)ialised.
>> 
>> For me, the 'objects", the 'ref/heads', the "staging area' and the like,
>> also lie within the repository.
> 
> Does it?
> 
> Suppose you have three directories, each with exactly the same contents
> in their corresponding .git directory, the only difference is the
> .git/index file:
> 
>   a) No .git/index file at all
>   b) The .git/index file doesn't have anything staged
>   c) The .git/index file contains some staged changes
> 
> Do you really consider them three different repositories?
> 
> In my mind the staging area is where you put stuff in preparation for
> the commit. The commit is part of the repository, the staging area
> isn't.
> 

I think I do consider them as different, yes, but in the sense that,
because the contents of any working directory can change in isolation
to the others, they have become different instances (perhaps clones?)
of the same repository.

Let's say I make two commits, that resulted in the same state of the
files in the working directory, but I make them in different order
in two of the working directories.

Clearly I need to sync the two different repositories in order to gain
a consistency across them, and that suggets, to me, that they should
be thought of as different.

Let's say I'd rsync-d one working directory, in which I'd made changes
on its branch, with an unchanged one on a different branch (not that
I'd recommend doing this without the utmost caution), then although the
sync will not have affected the original branch in the unchanged directory,
the git internals, stored in the .git repository, would have changed to
reflect the new state.

As to the staging area,

again, for me, Git has an understanding of a "staging area" based on its
inspection of the state of the working directory and a comparison of that
state with what it knows has been committed.

Given that one can stash uncommited changes fron the "staging area", I
think of both the "staging area" and various stashes as parts of the
repository, in that you can't have a "staging area", unless there's a
.git repository there to help instantiate the staging area".


Very much my perception of it all though: as others have pointed out,
there does seem to be some wriggle room in how it is percieved.

Kevin

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

* Re: Definition of "the Git repository"
  2021-06-28  4:00       ` Kevin Buckley
@ 2021-06-28  5:21         ` Felipe Contreras
  2021-06-29  1:57           ` Kevin Buckley
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2021-06-28  5:21 UTC (permalink / raw)
  To: Kevin Buckley, git

Kevin Buckley wrote:
> On 2021/06/28 11:24, Felipe Contreras wrote:
> > Kevin Buckley wrote:
> > 
> >> Everything within the .git directory "belongs", in my way of thinking,
> >> to the "repository", that is, the directory that gets created when git
> >> is (init)ialised.
> >> 
> >> For me, the 'objects", the 'ref/heads', the "staging area' and the like,
> >> also lie within the repository.
> > 
> > Does it?
> > 
> > Suppose you have three directories, each with exactly the same contents
> > in their corresponding .git directory, the only difference is the
> > .git/index file:
> > 
> >   a) No .git/index file at all
> >   b) The .git/index file doesn't have anything staged
> >   c) The .git/index file contains some staged changes
> > 
> > Do you really consider them three different repositories?
> > 
> > In my mind the staging area is where you put stuff in preparation for
> > the commit. The commit is part of the repository, the staging area
> > isn't.
> > 
> 
> I think I do consider them as different, yes, but in the sense that,
> because the contents of any working directory can change in isolation
> to the others, they have become different instances (perhaps clones?)
> of the same repository.
> 
> Let's say I make two commits, that resulted in the same state of the
> files in the working directory, but I make them in different order
> in two of the working directories.
> 
> Clearly I need to sync the two different repositories in order to gain
> a consistency across them, and that suggets, to me, that they should
> be thought of as different.

Yes, but this has nothing to do with .git/index. You are talking about
branches and commits. Clearly these are parts of a repository, and
nobody objects to that.

> As to the staging area,
> 
> again, for me, Git has an understanding of a "staging area" based on its
> inspection of the state of the working directory and a comparison of that
> state with what it knows has been committed.

Wouldn't it be much easier to say that git is comparing the working
directory with HEAD?

Clearly HEAD is part of the repository, and so is the commit that it's
pointing to (indirectly or directly).

But that doesn't say anything about the staging area, which is between
the two (in my mind): the working directory and the repository.


To try to make it more orthogonal, let's suppose the index file was
outside the .git directory. Would you consider then the staging area
separate from the repository?

In fact, we don't have to suppose:

  GIT_INDEX_FILE=/tmp/index git checkout @~ -- .

Does that command change the repository in any way?

-- 
Felipe Contreras

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

* Re: Definition of "the Git repository"
  2021-06-28  2:24   ` Kevin Buckley
  2021-06-28  3:24     ` Felipe Contreras
@ 2021-06-28 15:18     ` Philip Oakley
  2021-06-28 15:34       ` Chris Torek
  1 sibling, 1 reply; 15+ messages in thread
From: Philip Oakley @ 2021-06-28 15:18 UTC (permalink / raw)
  To: Kevin Buckley, git

On 28/06/2021 03:24, Kevin Buckley wrote:
> On 2021/06/26 04:48, Philip Oakley wrote:
>>
>> ... One can also include in the generic 'repository' the
>> various special .git* files that are [user] added to the main source
>> directory.
>>
>> But it gets worse. In the .git directory there is the 'objects' ...
>
> I don't believe it does get worse, indeed, I am not convinced that it
> is as bad as your observation on the semantics might suggest.
>
> Everything within the .git directory "belongs", in my way of thinking,
> to the "repository", that is, the directory that gets created when git
> is (init)ialised.

Part of my view (of the multiplicity of descriptives within Git)
regarding what is in a repository is from comparing the git created
content from a clone, that of a `git init`, and a users overall project
and .git trees after multiple interactions. Each has different features.

>
> For me, the 'objects", the 'ref/heads', the "staging area' and the like,
> also lie within the repository.
>
> As for any anciliary files, that control how the git commands actually
> process any data in the "working directory" beyond the defaults, some
> of them, eg the global commands, will typically exist outside of the
> working directory: below one's home directory, and, of course, there
> are the system-wide files, typically below /etc.
>
> Given then, that we can have Git-related files, for any given working
> directory, below /etc, below the user's home directory, and within the
> working directory itself, perhaps it is the whole "computer" which
> should be referred to as "the repository"?
>
> Furthermore, even in the case of anciliary files typically found within
> the working directory, and I'm thinking of .gitignore as the obvious
> example, even the directives in that can be overriden on the command
> line, as well as complemented by files outside of the working directory.
>
>
> I am tempted to say that even if the definition of a "repository" can't
> be agreed on, or rather, easily determined by inspection, then at least
> the corresponding working directory can be, however, the fact that one
> has  access to EnvVars and corresponding command line arguments such as
> --git-dir=<path>, --work-tree=<path>, would suggest that it could be
> harder for the novice to get their head around things, however, as it is
> typicaly clear what the working directory is (the top level directory
> containing the files you are working on, under the control of Git),
> calling that same directory the "repository" seems, to me anyway, to add
> to any confusion, that a Git novice may have.
>
> Given the can of worms that this question has opened up, although I'm
> getting the feeling that it has long since been opened, I still maintain
> that it would be less confusing, at least for a novice, for the working
> directory to be identified and for a previously non-existent directory,
> that gets created by the 'git init', to be referred to as the repository,
> so as to make a distinction.

My main point was that there is this creative tension between the
different contexts and that beginners should be aware that it's not all
cut and dried in the same way that language definitions tend to be.

--

Philip


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

* Re: Definition of "the Git repository"
  2021-06-28 15:18     ` Philip Oakley
@ 2021-06-28 15:34       ` Chris Torek
  0 siblings, 0 replies; 15+ messages in thread
From: Chris Torek @ 2021-06-28 15:34 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Kevin Buckley, Git List

On Mon, Jun 28, 2021 at 8:24 AM Philip Oakley <philipoakley@iee.email> wrote:
> My main point was that there is this creative tension between the
> different contexts and that beginners should be aware that it's not all
> cut and dried in the same way that language definitions tend to be.

Users should be aware that users are humans, and humans are
not consistent.  Nothing is as cut-and-dried as it might appear, ever.  Or,
as Kant put it: "Out of the crooked timber of humanity, no straight thing
was ever made." https://en.wikipedia.org/wiki/Crooked_Timber

(If you want to put fine distinctions on things, some parts of a repository
are repository-wide, and some parts are work-tree-specific.  The git
worktree command, when it adds a new work-tree, adds a new index
and HEAD and *_HEAD and other work-tree-specific refs, for instance.
That said, I still teach that .git mainly contains the repository proper,
with the rest being your working tree -- or, once we introduce git worktree,
your *main* working tree.)

Chris

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

* Re: Definition of "the Git repository"
  2021-06-28  5:21         ` Felipe Contreras
@ 2021-06-29  1:57           ` Kevin Buckley
  2021-06-29  2:08             ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Kevin Buckley @ 2021-06-29  1:57 UTC (permalink / raw)
  To: git

On 2021/06/28 13:21, Felipe Contreras wrote:
> 
> To try to make it more orthogonal, let's suppose the index file was
> outside the .git directory. Would you consider then the staging area
> separate from the repository?
> 
> In fact, we don't have to suppose:
> 
>    GIT_INDEX_FILE=/tmp/index git checkout @~ -- .
> 
> Does that command change the repository in any way?
  
I have to admit that I don't know, and that I can't immediately
see where the "repository" would be, in that example. This is
obviously a gap in my understanding: happy to defer to yours.

I do however feel that the fact that we have moved to using examples
that override the Git Index file on the command line, in order to
define what a "repository" is, just so that we might be able to give
a "more correct" definition of the term, to someone completely new to
Git, suggests that, as others have already noted in the discussion,
it's not easy to be "correct"?

Kevin

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

* Re: Definition of "the Git repository"
  2021-06-29  1:57           ` Kevin Buckley
@ 2021-06-29  2:08             ` Felipe Contreras
  0 siblings, 0 replies; 15+ messages in thread
From: Felipe Contreras @ 2021-06-29  2:08 UTC (permalink / raw)
  To: Kevin Buckley, git

Kevin Buckley wrote:
> On 2021/06/28 13:21, Felipe Contreras wrote:
> > 
> > To try to make it more orthogonal, let's suppose the index file was
> > outside the .git directory. Would you consider then the staging area
> > separate from the repository?
> > 
> > In fact, we don't have to suppose:
> > 
> >    GIT_INDEX_FILE=/tmp/index git checkout @~ -- .
> > 
> > Does that command change the repository in any way?
>   
> I have to admit that I don't know, and that I can't immediately
> see where the "repository" would be, in that example. This is
> obviously a gap in my understanding: happy to defer to yours.

Well, think about it.

> I do however feel that the fact that we have moved to using examples
> that override the Git Index file on the command line, in order to
> define what a "repository" is, just so that we might be able to give
> a "more correct" definition of the term, to someone completely new to
> Git, suggests that, as others have already noted in the discussion,
> it's not easy to be "correct"?

No. The repository is what the repository is. The command is merely an
aid for *you* to think about it.

If you are trying to define what a swan is, and you think a swan is a
white bird, but then I show you a black swan, what do you think you
should do with your definition?

What's complicated about this definition?

  A git repository is contained in the .git directory, but it's not the
  same thing. The staging area is usually inside the .git directory too,
  but it's not part of the repository.

Why do you want to make it more complicated than that?

-- 
Felipe Contreras

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

* Re: Definition of "the Git repository"
  2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
                   ` (4 preceding siblings ...)
  2021-06-25 20:48 ` Philip Oakley
@ 2021-06-29  6:59 ` Junio C Hamano
  5 siblings, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2021-06-29  6:59 UTC (permalink / raw)
  To: Kevin Buckley; +Cc: git

Kevin Buckley <Kevin.Buckley@pawsey.org.au> writes:

> git init
>
> initialises a Git repository, however, the only thing that changes
> as a result is that a .git directory has been created, ergo, the
> .git directory is the repository.

Well, there is a distinction between "non-bare" and "bare"
repository, so it is not exactly _wrong_ per-se to include the
working tree portion of a non-bare repository as part of the
repository created when you run "git clone", i.e. it is not a crime
to say "please run 'git clone' to get a new repository to work in".

Often we do need to single out the things under .git/ in a non-bare
repository when explaining certain features of Git, and need to
clarify if it is not clear in the context (e.g. "the .git repository
proper in the result of such a non-bare 'git clone'").  

It is nothing new in inter-human communication.

If there is a use of word "repository" in our documentation where it
is not clear if the repository proper or the combination of both
working tree and the repository prper is meant, you may want to
propose a clarification patch.

Thanks.

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

end of thread, other threads:[~2021-06-29  6:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25  1:44 Definition of "the Git repository" Kevin Buckley
2021-06-25  5:56 ` Ævar Arnfjörð Bjarmason
2021-06-25  8:56 ` Igor Djordjevic
2021-06-25  9:14 ` Igor Djordjevic
2021-06-25 19:39 ` Felipe Contreras
2021-06-25 20:48 ` Philip Oakley
2021-06-28  2:24   ` Kevin Buckley
2021-06-28  3:24     ` Felipe Contreras
2021-06-28  4:00       ` Kevin Buckley
2021-06-28  5:21         ` Felipe Contreras
2021-06-29  1:57           ` Kevin Buckley
2021-06-29  2:08             ` Felipe Contreras
2021-06-28 15:18     ` Philip Oakley
2021-06-28 15:34       ` Chris Torek
2021-06-29  6:59 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.