From: Johannes Schindelin Date: Tue, 09 Aug 2005 00:03:46 GMT Subject: Re: "git revert" (Re: pci_update_resource() getting called on sparc64) Message-ID: In-Reply-To: <7vd5oo11wj.fsf@assigned-by-dhcp.cox.net> Hi, On Mon, 8 Aug 2005, Junio C Hamano wrote: > Linus Torvalds writes: > > > Or if you want to be more CVS-like, use "-F", and accept "-" for stdin? > > Yes my vote goes: > > -m "message" > -c "from this commit, literally." > -C "from this commit, but let me edit the log further." > -F "from this file." > -F - ...]' + die 'git commit [options] [...] +Options: + --all automatically do a git-update-cache on all modified + files + -m use this message in the commit + -c use the same message as in the given commit + -C as -c, but let me edit it + -F take the message from file + -F - take the message from stdin' } files=() +call_editor=true +rm -f .editmsg || die "Could not write edit message" while case "$#" in 0) break ;; esac do case "$1" in + -m|-c|-C|-F) + [ "$#" -ne 1 ] || usage;; + esac + + case "$1" in -m) shift - case "$#" in - 0) usage ;; - *) use_commit=`git-rev-parse --verify "$1"` || - exit ;; - esac - ;; + call_editor="" + echo "$1" >> .editmsg;; + -c) shift + call_editor="" + use_commit=`git-rev-parse --verify "$1"` || + exit ;; + -C) shift + use_commit=`git-rev-parse --verify "$1"` || + exit ;; + -F) shift + call_editor="" + cat "$1" >> .editmsg;; --all) files=($(git-diff-files --name-only))\ ;; @@ -42,7 +63,7 @@ if [ ! -r "$GIT_DIR/HEAD" ]; then echo "#" git-ls-files | sed 's/^/# New file: /' echo "#" - ) > .editmsg + ) >> .editmsg PARENTS="" else if [ -f "$GIT_DIR/MERGE_HEAD" ]; then @@ -83,7 +104,7 @@ else export GIT_AUTHOR_DATE git-cat-file commit "$use_commit" | sed -e '1,/^$/d' - fi >.editmsg + fi >> .editmsg git-status-script >>.editmsg fi if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ] @@ -92,11 +113,10 @@ then rm .editmsg exit 1 fi -case "$use_commit" in -'') - ${VISUAL:-${EDITOR:-vi}} .editmsg - ;; -esac + +[ -z "$use_commit" -o "$call_editor" = true ] && +${VISUAL:-${EDITOR:-vi}} .editmsg + grep -v '^#' < .editmsg | git-stripspace > .cmitmsg [ -s .cmitmsg ] && tree=$(git-write-tree) &&