freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Re: git problem solved


From: Werner LEMBERG
Subject: [ft-devel] Re: git problem solved
Date: Sun, 08 Mar 2009 13:14:14 +0100 (CET)

> - what is the TRASH_OFF variable for?

Oops!  I'm using the `libtrash' library as a kind of `trashcan' for
catching delete operations on the system level -- I thus don't have to
be afraid of `rm -rf *' -- and setting this environment variable
prevents this.  Please ignore it.

> - you are probably on a Unix-like operating system without
>   braindamaged directory names that contain spaces.  Otherwise you
>   have to quote the $1 in your cd commands.

OK.

> - instead of `echo $filename | sed 's/^.* //'` it is probably nicer
>   to write ${filename##* }.  All shells (with the exception of the
>   Solaris default /bin/sh that is not even POSIX compatible)
>   understand that syntax.

I've never heard of that :-)  Applied, thanks.

> - you do not need the env-filter, as you only define FILENAME there,
>   and only use that variable in the msg-filter.  So you can define
>   (and not even export it) in msg-filter.

OK, changed.  BTW, does it make a difference?

> - instead of cat ... | sed "/--- snip here ---/,\$d" it is slightly
>   more efficient to say sed '/--- snip here ---/q' < ...

OK.  However, your sed expression doesn't work: '/--- snip here ---/q'
does still emit this line.

Attached two new versions.


    Werner
# get-empty-logs <git repository>
#
# Written by Werner Lemberg <address@hidden>.
#
# 08-March-2009
#
# Public domain.
#
#
# From the given repository, this script exctracts commit messages named
#
#   *** empty message ***
#
# and stores them, together with the corresponding diff, in the current
# directory in files of the form
#
#   <commit date> <commit hash>.txt
#
# The idea is that you modify the messages to something more meaningful.
# Note that everything below (and including) the `snip here' line won't
# be part of the commit message.
#
# After finishing you should call the `regenerate-git' script to apply the
# updated commit messages.

currdir=`pwd`
cd "$1"

# If you have
#
#   filename='aa bbb cccc'
#
# `${filename##* }' strips off the (greedy) regexp `* ', which is `aa bbb '.

git log --pretty='format:%ci %H' \
        --grep='\*\*\* empty log message \*\*\*' \
| sed 's/ +0000//' \
| while read filename; do
    git show --pretty=format:'%s%n--- snip here ---%n%b' \
        ${filename##* } \
    > "$currdir/$filename.txt"
  done

# eof
# regenerate-git <git repository>
#
# Written by Werner Lemberg <address@hidden>.
#
# 08-March-2009
#
# Public domain.
#
#
# This script applies commit messages in files named
#
#   <commit date> <commit hash>.txt
#
# (as created by the `get-empty-logs' script, for example) to the given git
# repository; the files are expected to be in the current directory.
#
# The idea is that all git objects are checked whether a file name's <commit
# date> and <commit hash> is identical to a git object's commit date and
# commit hash, respectively.  If true, the file's contents down to the `snip
# here' line (which isn't included) is used as a new commit message.

export currdir=`pwd`
cd "$1"

git filter-branch \
  --tag-name-filter cat \
  --msg-filter 'filename=`git show -s --pretty="format:%ci %H" $GIT_COMMIT \
                          | sed "s/ +0000//"`
                if test -f "$currdir/$filename.txt"; then
                  sed "/--- snip here ---/,\$d" < "$currdir/$filename.txt";
                else
                  cat;
                fi'

# eof

reply via email to

[Prev in Thread] Current Thread [Next in Thread]