Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adeodato Simó <dato@xxxxxxxxxxxxxx> writes:

> However, I've as of late directly created bare repositories knowing that
> I wanted to work just with workdirs against it. In this case, the logs
> for each checkout'ed branch will be stored in the workdirs and not the
> repo, so deleting the workdir will make you lose those logs. Which is
> bad, since workdirs should always be safe to delete.

I had to think about the above for a while, but after realizing that you
have a strict distinction between a "workdir" and a normal "repository
with a work tree" in mind, I can see where you are coming from.  A workdir
is transient in nature and you should be able to dismiss it safely as long
as the repository it borrows from is intact.

But "safely" is somewhat relative.

What state would you be discarding when you remove a workdir?  I can think
of:

 - local uncommitted changes, in the work tree contents and in the index
   (obviously);

 - reflog for the HEAD (aka branch switching);

 - what branch you had checked out when you discarded the workdir;

and everything else (commits created, the tips and histories of refs,
configuration changes) are kept in the .git repository of the original.

But what if the original does _not_ want to keep track of changes of
certain nature?  It is nonsensical for the original not to want to keep
the commits nor the tips of the refs, but it is not unreasonable for a
bare repository used as a distribution point not want to keep reflogs, for
example.  A workdir could be defined as "a transient work tree created on
an existing repository, the side effects of working in which are saved to
the original repository (except for the ones listed above).  The kind of
side effects saved are however limited to the ones that are saved while
working in the original repository."

With such a definition, you can "safely" create a workdir out of a bare
repository, without fear of contaminating it with unwanted reflogs.

I tend to think the definition your patch seems to use would be more
useful in practice, though.

    A workdir is a new work area that is not a normal "work tree with a
    full repository", but borrows from an existing repository.  Any side
    effect from the work you do in a workdir will be saved in the original
    repository, and removing one would lose only the three kind of
    information listed above.  Creating a new workdir has the side effect
    of enabling reflogs and rerere in the original repository.

But the last sentence somehow feels dirty.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux