All of lore.kernel.org
 help / color / mirror / Atom feed
* Can we get a git clone flag to override the "required empty directory" behaviour?
@ 2015-07-24 18:04 Mike Kasprzak
  2015-07-24 21:41 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Kasprzak @ 2015-07-24 18:04 UTC (permalink / raw)
  To: git

Hi,

I run a project with 2 repositories. One is a vagrant based toolchain
(a VM that runs a LAMP server), and the other is the source code.
Because I want my users to keep and make their changes to a clone of
the source repository, we can't use submodules. They make their
changes, test locally, and push them at me when they're done.

The source code goes in a 'www' subdirectory, but for an improved user
experience, I include a pre-configured version of the config file in
that 'www' directory. That way, after they check out the code and
start their local server, it just works. Easy.

What I would like to do is git clone inside that directory. Alas, git
will not let you clone in any directory containing a file.

Today we use `the workaround`, which involves doing a git init, adding
a remote origin, fetching, and finally checking it out.

http://stackoverflow.com/a/18999726

This is `fine`, but it's not a good user experience. All we really
want is a clone, and there just happens to be a configuration file
pre-installed in the same directory.

Can we please get a flag (say -f or --force) for git clone that
overrides the default behavior of not allowing you to clone in to a
non-empty directory. If there already was a .git directory in that
directory, sure that's a no-go scenario. An with a name like --force,
it should be aggressive, overwriting anything it sees. Again, git can
already do this, it's just a lot more long winded that it should be.

Thanks,

Mike Kasprzak

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

* Re: Can we get a git clone flag to override the "required empty directory" behaviour?
  2015-07-24 18:04 Can we get a git clone flag to override the "required empty directory" behaviour? Mike Kasprzak
@ 2015-07-24 21:41 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2015-07-24 21:41 UTC (permalink / raw)
  To: Mike Kasprzak; +Cc: git

Mike Kasprzak <mike@sykhronics.com> writes:

> What I would like to do is git clone inside that directory. Alas, git
> will not let you clone in any directory containing a file.

In the ideal world, I think both of these two commands:

    $ git clone $URL somewhere
    $ cd somewhere && git clone $URL .

should behave just like:

    - if somewhere/.git exists, barf and fail
    - otherwise, do the "git init && git add remote && git fetch"
      followed by "git checkout" dance.

without any additional option.  The final "checkout" step should
fail if the "untracked files" you have in the existing directory
interfere with it.

It used to be that you always had to create a "new" directory, not
even an empty directory was allowed.  Recently we took a small step
in that direction.

That hasn't happened, and will not happen unless somebody works on
it.  The thing is that it would not just be the matter of adding a
command line flag.  There are tons of things "git clone" can do
differently from "git fetch" and using much simpler and performant
logic because it assumes that the directory it is cloning into is an
empty one.

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

end of thread, other threads:[~2015-07-24 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 18:04 Can we get a git clone flag to override the "required empty directory" behaviour? Mike Kasprzak
2015-07-24 21:41 ` 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.