From: Petr Baudis <pasky@ucw.cz>
To: Alexey Nezhdanov <snake@penza-gsm.ru>
Cc: git@vger.kernel.org
Subject: Re: Adapting scripts to work in current (not top) directory
Date: Fri, 13 May 2005 15:53:59 +0200 [thread overview]
Message-ID: <20050513135359.GA28138@pasky.ji.cz> (raw)
In-Reply-To: <200505131459.08891.snake@penza-gsm.ru>
Dear diary, on Fri, May 13, 2005 at 12:59:08PM CEST, I got a letter
> I have opted for current directory and not root. Explanation is later this
> mail. New variant:
Yes, that's fine.
> =========================
> --- /home/snake/scm/cogito/cg-Xlib 2005-05-12 08:47:29.000000000 +0400
> +++ cg-Xlib 2005-05-13 13:40:58.000000000 +0400
> @@ -8,7 +8,17 @@
>
> _cg_cmd=${0##*/}
>
> -_git=${GIT_DIR:-.git}
> +repopath=`pwd`
> +while ((1)) ; do {
> + [ -d "$repopath/.git" ] && break
> + [ "$repopath" == "/" ] && {
> + repopath=`pwd`;
> + break;
> + };
> + repopath=`dirname $repopath`
> +}; done
> +
> +_git=${GIT_DIR:-$repopath/.git}
> _git_objects=${GIT_OBJECT_DIRECTORY:-$_git/objects}
Looks basically fine.
> =========================
> Here is a problem:
> Because of git backend only some of the commands should be enabled to work
> from current directory. F.e. cg-init should not scan upper directories for
> ".git" but should instead stick to current directory. In the script above
> this workarounded as choosing current directory instead of root but this will
> broke if we trying to initialise repo in a subdirectory of another repo.
I'd set some flag like $reposubdir if .git was found in some of the
parent directories. Then test that in the relevant commands.
> So I have analysed list of cogito commands to find out which ones should be
> adopted to use "find repo" behaivoir:
>
> "+" means "definitely yes"
> "-" means "definitely no"
> "?" means "not sure"
> "." means "not matter"
>
> + cg-add
> ? cg-admin-lsobj
Sure.
> - cg-admin-uncommit
> ? cg-branch-add
> ? cg-branch-ls
Sure (both).
> - cg-cancel
> - cg-clone
> - cg-commit
This one should, committing only the subdirectory content.
> + cg-diff
> - cg-export
Perhaps it could export just the subdirectory?
> . cg-help
> - cg-init
> + cg-log
> + cg-ls
(Listing the appropriate subdir.)
> - cg-merge
> + cg-mkpatch
> ? cg-patch
This one should, using the appropriate -p level.
> - cg-pull
> - cg-restore
This one should, restoring only the subdirectory.
> + cg-rm
> - cg-seek
> + cg-status
> - cg-tag
> ? cg-tag-ls
Why not...
> - cg-update
> . cg-version
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
prev parent reply other threads:[~2005-05-13 13:46 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
2005-05-13 10:59 ` Alexey Nezhdanov
2005-05-13 13:53 ` Petr Baudis [this message]
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=20050513135359.GA28138@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 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).