[Libreoffice] modification of ./bin/g to allow git repository name substitution in the command line

Norbert Thiebaud nthiebaud at gmail.com
Sat Oct 23 00:55:00 PDT 2010


Hi,

I'd like to make the following change to ./bin/g

diff --git a/bin/g b/bin/g
index 27fcf3f..01ee6bb 100755
--- a/bin/g
+++ b/bin/g
@@ -126,6 +126,7 @@ for DIR in * ; do
                 PWDLEN=`pwd | wc -c`
                 for I in "${FILES[@]}" ; do
                     unset FILES[$FILESNUM]
+                   I=${I//@REPO@/${DIR}}
                     FILESNUM=$(($FILESNUM+1))
                     # filter out files that don't belong to this repo
                     if [ "${I:0:1}" = "/" ] ; then


The rational is this:

Some git operation need to be run, not only on each git repos, but
also with a parameter on the command line that reflect the current git
repo on which the command is run.

for example.

You want to modify the .git/config of each git repo to set the pushurl
appropriately:

./bin/g config remote.origin.pushurl
git+ssh//git.freedesktop.or/git/libreoffice/@REPO@

or you want to generate all the patches accumulated on all repo,
including the name of the repos in the patch names, and storing them
outside the tree in a subdirectory per repo:

g format-patch --suffix=- at REPO@.patch
--output-dir=/home/n_th/out_patches/@REPO@ master..HEAD

I used @REPO@ as a tag, because I didn't want to deal with escaping
nightmare, and @REPO@ is very unlikely to legitimately be on the
command line on its own right.

I am not attached to it, or to this particualr way of fixing this
problem. I just want to be able to run the two examples above (and
others similar) one way or another.

Norbert


More information about the LibreOffice mailing list