Re: What commands can and can not be used with bare repositories?

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

 



Theodore Ts'o <tytso@xxxxxxx> wrote:
> What isn't documented is what commands actually can deal with a bare
> repository.  At the moment, it looks like a bare repository can be a
> target of a git pull, push, and merge commands

Sorry but 'git merge' cannot be used in a bare repository (no working
directory to update during the merge) and 'git merge' can only work on
the current repository, which rules out the bare repository.

> and it can be a source
> for a git clone, but that seems to be about it.  All other commands,
> such as "git log" blow up with the error message "Not a git repository".

Try "git --bare log".  Or "git --git-dir=/path/to log".

> This to me seems a bit lame, since why isn't a "bare repository" also a
> "git repository"?  All of the information is there for "git log" to
> work.  Commands that require a working directory obviously can't work,
> but there are plenty of git commands for which there's no reason why
> they shouldn't be able to operate on a bare repository.  For example,
> "git repack", "git log", "git fetch", etc.

Actually most commands work on a bare repository.
Very few don't: the ones that require a working directory.
E.g. status/revert/cherry-pick/commit/am/merge/pull.  (You can
pull from a bare repository, but you cannot run pull *in* a bare
repository.)

> confused, but maybe we could fix that.  What if we were to change "git
> clone --bare" to create the .git -> . symlink, and then add a check to
> commands that require a working directory to see if ".git" is a symlink
> to ., and if so, give an error message, "operation not supported on bare
> repository"?

No.  Better would be to make git's repository setup logic
automatically detect if "." is a Git repository, and if so let the
commands that work without a working directory run.

-- 
Shawn.
-
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]