git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Kevin Buckley <Kevin.Buckley@pawsey.org.au>, git@vger.kernel.org
Subject: Re: Definition of "the Git repository"
Date: Mon, 28 Jun 2021 00:21:36 -0500	[thread overview]
Message-ID: <60d95c6024f3d_aaf7e208a4@natae.notmuch> (raw)
In-Reply-To: <ec31434f-0c99-ffb7-6eb0-6ecb1f6e761c@pawsey.org.au>

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

  reply	other threads:[~2021-06-28  5:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60d95c6024f3d_aaf7e208a4@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=Kevin.Buckley@pawsey.org.au \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).