2010年11月29日 星期一

我的git使用經驗

我在一個新的sdk中自已用了git來測驗
我發現git-status有時候很慢,查了一下,有人說用git-gc來加快access
於是我下了git-gc,等了幾分鐘後還是沒run完,一看memroy,竟被吃光了:

peter$ git-gc
Counting objects: 88839, done.

Compressing objects:  18% (15328/84733)
後來改用
git-diff --stat就快多了

petert$ git diff --stat drivers/
 .../hal/linux/public/mipsisa32-be-elf.opt_ah.h     |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
git-status用git-commit同樣的options, 主要是用來比較git-commit時會發生那些變動
git-status其實就是git-commit --preview, 見意採用git-diff --stat…
http://stackoverflow.com/questions/715321/git-status-is-there-a-way-to-show-changes-only-in-a-specific-directory

The reason that git status takes the same options as git commit is that the purpose of git status is to show what would happen if you committed with the same options as you passed to git status. In this respect git status is really git commit --preview.
To get what you want, you could do this which shows staged changes:
git diff --stat --cached -- 
and this, which shows unstaged changes:
git diff --stat -- 
or this which shows both:
git diff --stat HEAD -- 

lighttpd porting


CC="mips-linux-gcc -I/tmp/rootfs/lighttpd/include -L/tmp/rootfs/lighttpd/lib" LD="mips-linux-ld -L/tmp/rootfs/lighttpd/lib" ./configure --target=mips-linux --host=mips-linux --without-zlib --prefix=/tmp/rootfs/lighttpd --without-bzip2 --disable-ipv6 --with-pcre=/tmp/rootfs/lighttpd/lib/

-----------------------------------------------------
設定 lighttpd.conf
  1. document root
    修改lighttpd.conf
    var.server_root = "/tmp/rootfs/www"
    server.port = 1234
    var.conf_dir    = "/tmp/rootfs/etc/lighttpd"
  2. cgi module.
    修改modules.conf
    include "conf.d/cgi.conf"
  3. 修改conf.d/cgi.conf
    cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                                 ".cgi" => "/tmp/rootfs/www/cgi/ssi",
                                   ".rb"  => "/usr/bin/ruby",
                                   ".erb" => "/usr/bin/eruby",
                                   ".py"  => "/usr/bin/python" )



 在target board edit 「/tmp/rootfs/www/cgi/ssi」如下,and chmod +x.
#!/bin/sh
echo -ne "Content-Type: text/plain\n\n";
echo -ne "Hi there! This is a sample perl program!!!\n";
set

 測試 url: http://172.21.46.138:1234/index.cgi
CONTENT_LENGTH='0'
DOCUMENT_ROOT='/tmp/rootfs/www'
GATEWAY_INTERFACE='CGI/1.1'
HTTP_ACCEPT='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
HTTP_ACCEPT_CHARSET='UTF-8,*'
HTTP_ACCEPT_ENCODING='gzip,deflate'
HTTP_ACCEPT_LANGUAGE='zh-tw,en-us;q=0.7,en;q=0.3'
HTTP_CACHE_CONTROL='max-age=0'
HTTP_CONNECTION='keep-alive'
HTTP_HOST='172.21.46.138:1234'
HTTP_KEEP_ALIVE='115'
HTTP_USER_AGENT='Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1 (.NET CLR 3.5.30729)'
IFS='  
'
LD_LIBRARY_PATH='/tmp/rootfs/lighttpd/lib'
PATH='/usr/local/bin:/usr/bin:/sbin:/bin'
PPID='797'
PS1='\w \$ '
PS2='> '
PS4='+ '
PWD='/tmp/rootfs/www'
REDIRECT_STATUS='200'
REMOTE_ADDR='172.21.33.212'
REMOTE_PORT='2161'
REQUEST_METHOD='GET'
REQUEST_URI='/index.cgi'
SCRIPT_FILENAME='/tmp/rootfs/www/index.cgi'
SCRIPT_NAME='/index.cgi'
SERVER_ADDR='0.0.0.0'
SERVER_NAME='172.21.46.138'
SERVER_PORT='1234'
SERVER_PROTOCOL='HTTP/1.1'
SERVER_SOFTWARE='lighttpd/1.4.28'
當IE brower URL:http://172.21.46.138:1234/index.cgi 時,lighttpd會根據cgi.conf所設定的副檔名來執行程式(以此為例,真正的執行檔為「/tmp/rootfs/www/cgi/ssi, 而index.cgi這個file實際上可能不存在

但這不是我想要的結果:
所以我做了點小修改: 
  1. 將www/cgi/ssi link到www
    再將原來的ssi rename為ssi.exe
  2. 小改一下cgi.conf
    cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                                   ".cgi" => "/tmp/rootfs/www/cgi/ssi.exe",
                                   ".asp" => "/tmp/rootfs/www/cgi/ssi.exe",
                                   ".rb"  => "/usr/bin/ruby",
                                   ".erb" => "/usr/bin/eruby",
                                   ".py"  => "/usr/bin/python" )
peter@team-server:www$ tree cgi
cgi
|-- ssi -> ../
`-- ssi.exe


測試一下

http://172.21.46.138:1234/cgi/ssi/index.asp
可以work了!