[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

live-manual: Proposal to add a chapter on cloning and pulling to 'Git repositories'



Hi guys,

I was thinking about improving the "Git repositories" section of
live-manual. The initial idea was to make a very, very short
introduction naming the type of server the project uses or something
like that (but this is not very important). Then, leaving the already
existing text as it is right now (except for changing the order of the
first and second sentences, which would follow a more logical order)
and last but not least adding a new chapter on cloning and pulling
from these particular repositories (or perhaps two chapters, one for
cloning and one for pulling).

The "already existing" text gives examples of how to clone/pull a
repository and I thought that since there are several repositories it
could be nice to be able to clone and pull from one/more than one at
the same time.

I'm sending the proposal to the list because it deals with project
affairs so I think someone should take a look at it first and decide
whether it is appropriate or not to add it. I use it more or less as I
describe below, so it is a personal use that does not necessarily have
to be endorsed at all by the live team. I simply do not want to push
crap hence I send it for your consideration first. I could have pasted
and posted it on irc but it is perhaps a bit long.

I will gladly add it to live-manual if you think it is worth it and if
you think that it is simply not worth adding, it is okay as well.

My local version is slightly different. I perform a couple of checks
in the repositories and I also cd "${WORKDIR}" at the end. But I have
omitted those purposely to keep it as simple as possible. It is also
nice to end up in the last cloned/pulled repository to "start work
right away".

Modifications, deletions, suggestions, improvements, $whatever are
extremely welcome. The text could be something like this:


### Cloning and pulling from one or several git repositories ###

If you intend to clone several of the Debian Live repositories and
switch to the debian-next branch right away to check the latest code,
write a patch or contribute with a translation, you can add a simple
snippet like the following one to your ${HOME}/.shell_functions to
make your life a little bit easier. The procedure is very similar for
most shells like for example bash or ksh.

 # Clone one or several debian-live repositories

 git_clone ()
 {
 WORKDIR="${HOME}/debian-live" #If this applies.
 CLONE_URL="git://live.debian.net/git" #For read-only or
"git@live.debian.net:" for ssh.

 echo "Cloning "${#}" repositories."

 for REPOSITORY in "${@}"
 do
	cd "${WORKDIR}"
	git clone "${CLONE_URL}/${REPOSITORY}.git"
	cd "${REPOSITORY}" && git checkout debian-next
 done
 }

You will have to source the file, in case it does not exist, in
${HOME}/.bashrc or ${HOME}/.kshrc as follows:

 if [ -f "${HOME}"/.shell_functions ]
	then
	. "${HOME}"/.shell_functions
 fi

This way, in order to clone one or several repositories, instead of
typing the full addresses, you will only have to type their names.
e.g.

 $ git_clone live-config live-boot live-manual ...

To pull from all the cloned repositories add this function:

 git_pull_all ()
 {
 WORKDIR="${HOME}/debian-live" #If this applies.
 echo "Pulling from "$(ls ${WORKDIR} | wc -l)" repositories."

 for REPOSITORY in "${WORKDIR}"/*
 do
 	echo "Pulling from "$(basename ${REPOSITORY})""
 	cd "${REPOSITORY}" && git pull --rebase
 done

 cd "${WORKDIR}"
 }


Or pull selectively by naming the repositories. e.g git_pull
live-config live-boot live-manual ...

 git_pull ()
 {
 WORKDIR="${HOME}/debian-live" #If this applies.
 echo "Pulling from "${#}" repositories."

 for REPOSITORY in "${@}"
 do
 	cd "${WORKDIR}"
 	echo "Pulling from "$(basename ${REPOSITORY})""
 	cd "${REPOSITORY}" && git pull --rebase
 done
 }



Thank you very much in advance and keep up the great work you are doing.

-- 
chals
www.chalsattack.com


Reply to: