mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
pgit.sh: Auto-detect current project in toplevel dir
This commit allows pgit.sh to target not only multiple projects below a projects-directory, but also one single project. If invoked from the toplevel directory of a project, it uses that as the only project it should deal with. This is meant to facilitate running the same VCS abstraction logic for one project as for many projects. The project or projects to deal with should probably be specified on the command line, but changing the auto-detection mechanism buys us what we want for now with low hassle. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
f28ee62209
commit
cb3ccaa338
1 changed files with 8 additions and 4 deletions
|
|
@ -39,10 +39,14 @@ set_global_variables()
|
||||||
{
|
{
|
||||||
[ "$projects_dir" ] || {
|
[ "$projects_dir" ] || {
|
||||||
projects_dir=`pwd`
|
projects_dir=`pwd`
|
||||||
while [ ! -r Makefile ] || ! grep -q some-random-string-to-id-this-makefile Makefile; do
|
# If we're in a toplevel directory, suppose projects_dir == project_dirs,
|
||||||
[ "$projects_dir" = / ] && fatal "Failed to find projects directory"
|
# i.e. we only want to target this Git repo
|
||||||
projects_dir=`dirname $projects_dir`
|
if [ ! -d .git ]; then
|
||||||
done
|
while [ ! -r Makefile ] || ! grep -q some-random-string-to-id-this-makefile Makefile; do
|
||||||
|
[ "$projects_dir" = / ] && fatal "Failed to find projects directory"
|
||||||
|
projects_dir=`dirname $projects_dir`
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$project_dirs" ] || {
|
[ "$project_dirs" ] || {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue