git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zenaan Harkness <zen@freedbms.net>
To: git <git@vger.kernel.org>
Subject: contrib/git-normal-to-bare.sh
Date: Mon, 27 May 2013 14:54:35 +1000	[thread overview]
Message-ID: <CAOsGNST8X+crMQz1ynJQxctCMUnBw3T3K5HiMH8B_GFP63yX1w@mail.gmail.com> (raw)

I needed this quite a bit in the last few days, basic script but
serves my need. I think it would be useful for other beginners if in
$git/contrib/ source dir.

Just a start to a basic script. Needs more tests etc, but it's enough
to get newbies (like me) off to a reasonable start. Handles multiple
input dirs.

PLEASE CC me, as I am not subscribed.

(some SMTP server rejected attachment, so pasting below instead)

Thanks,
Zenaan


#!/bin/bash

# Change one or more normal repos into bare repos:
# See also https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_make_existing_non-bare_repository_bare.3F

for i in "$@"; do
   echo; echo "----------------------"
   echo Processing $i

   repo="$i"
   repo="`basename $i`"
   tmp_repo="${repo}.git"

   # Insert here: may be exit if any spaces in repo fqn
   # Insert here: check for non-existent repo/.git dir
   # Insert here: check that we are not inside the repo
   # Insert here: add exit/do-nothing if fail to mv dirs etc

   mv $repo/.git $tmp_repo
   git --git-dir=$tmp_repo config core.bare true
   mv $repo ${repo}.bak
   mv $tmp_repo $repo
done

             reply	other threads:[~2013-05-27  4:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27  4:54 Zenaan Harkness [this message]
2013-05-28 20:07 ` contrib/git-normal-to-bare.sh Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2013-05-27  4:00 contrib/git-normal-to-bare.sh Zenaan Harkness
2013-05-27  9:02 ` contrib/git-normal-to-bare.sh Matthieu Moy
2013-05-27  9:43   ` contrib/git-normal-to-bare.sh Zenaan Harkness
2013-05-27  9:52     ` contrib/git-normal-to-bare.sh Fredrik Gustafsson
2013-05-29  2:52 ` contrib/git-normal-to-bare.sh Felipe Contreras

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=CAOsGNST8X+crMQz1ynJQxctCMUnBw3T3K5HiMH8B_GFP63yX1w@mail.gmail.com \
    --to=zen@freedbms.net \
    --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).