From: Petr Baudis <pasky@ucw.cz>
To: Alexey Nezhdanov <snake@penza-gsm.ru>
Cc: GIT Mailing List <git@vger.kernel.org>
Subject: Re: Adapting scripts to work in current (not top) directory
Date: Thu, 12 May 2005 22:12:15 +0200 [thread overview]
Message-ID: <20050512201215.GI324@pasky.ji.cz> (raw)
In-Reply-To: <200505121758.10971.snake@penza-gsm.ru>
Dear diary, on Thu, May 12, 2005 at 03:58:10PM CEST, I got a letter
where Alexey Nezhdanov <snake@penza-gsm.ru> told me that...
> All git and cogito scripts wants .git subdirectory. If I'm in a subdirectory
> that have no .git direcory in it I'm out of luck.
This is fine for Cogito, but Git itself shouldn't care - unless you mean
the bundled mini-plumbing scripts. I don't know if anyone (and who) uses
them except Linus, but I'm not likely to make much effort to maintain
them, or even to actually accept any non-trivial changes to them.
> I have wrote an example script that determines the lowest possible .git
> directory position and changes to it to satisfy user request.
>
> Problems with script:
> 1) May be I misunderstood the git ideology and it needs not this at all.
Cogito really needs it.
> if point (1) is false then there are couple of other problems:
> 2) Script is extremelly ugly. I'm a week bash programmer so please criticize.
> 3) This logic shold be somehow embedded to all git- and cg- scripts. I can not
> figure how to do it non-intruisively.
Add it to cg-Xlib. You can just update $_git appropriately. (Except when
you were explicitly passed GIT_DIR.)
> gitpath=
> subpath=
> curpath=`pwd`
> for ((i=2;i<9999;i=i+1)) ; do {
> path1=`echo $curpath | cut -d / -f 0-$i`
> path2=`echo $curpath | cut -d / -f $((i+1))-`
> [ -d "$path1"/.git ] && gitpath=$path1 && subpath=$path2
> [ "$path1" == "$curpath" ] && break
> }; done
I would gradually trim the $curpath by $(dirname) until I hit
$curpath/.git or the root directory.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
next prev parent reply other threads:[~2005-05-12 20:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-12 13:58 Adapting scripts to work in current (not top) directory Alexey Nezhdanov
2005-05-12 19:15 ` H. Peter Anvin
2005-05-12 20:12 ` Petr Baudis [this message]
2005-05-13 10:59 ` Alexey Nezhdanov
2005-05-13 13:53 ` Petr Baudis
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=20050512201215.GI324@pasky.ji.cz \
--to=pasky@ucw.cz \
--cc=git@vger.kernel.org \
--cc=snake@penza-gsm.ru \
/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 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.