git/list[1] front-page[2] threads[3] people[4] search[5] about
 

cogito: commit message from stdin and -m switch

From
Gerrit Pape <pape@smarden.org>
Date
Jan 2, 2006, 12:13 UTC
Message-ID
<20060102120709.13166.qmail@5a5356efda0133.315fe32.mid.smarden.org>
Hi, cg-commit(1) states
-m MESSAGE
       Specify the commit message, which is used instead of starting up
       an editor (if the input is not  stdin,  the  input  is  appended
       after  all the -m messages). Multiple -m parameters are appended
       to a single commit message, each as separate paragraph.

What happens is that the message on stdin overrides the message given through the -m switch:

 $ cg-init -m initial
 defaulting to local storage area
 Committing initial tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
 Committed as 4db6889339c6d6775b18673f12bc91adf86f1c2c.
 $ touch foo
 $ cg-add foo
 Adding file foo
 $ echo 'message1' |cg-commit -m 'message0'
 A foo
 Committed as 99d2bbca8ac65fa0c0af7c7536228f4b9470e70f.
 $ cg-log |head
 commit 99d2bbca8ac65fa0c0af7c7536228f4b9470e70f
 tree 4d5fcadc293a348e88f777dc0920f11e7d71441c
 parent 4db6889339c6d6775b18673f12bc91adf86f1c2c
 author Gerrit Pape <pape@smarden.org> Mon, 02 Jan 2006 12:07:59 +0000
 committer Gerrit Pape <pape@smarden.org> Mon, 02 Jan 2006 12:07:59 +0000
 
     message1
 
 commit 4db6889339c6d6775b18673f12bc91adf86f1c2c
 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
 $ 

This also breaks the selftests with stdin not connected to a terminal (so in Debian package autobuilder environment):

 $ make
 Generating cg-version...
 $ make test </dev/null 
 make -C t/ all
 make[1]: Entering directory
 `/usr/local/src/Debian/Upstream/GIT/cogito/t'
 *** t9000-init.sh ***
 *   ok 1: initialize w/o the initial commit
 [...]
 * FAIL 16: check if the commit is proper
         [ "$(git-cat-file commit HEAD | sed -n '/^parent/q; /^$/{n; :a p; n; b a}')" = "silly commit message
 
         continued" ]
 *   ok 17: blow away the repository
 [...]
 $ 
Regards, Gerrit.
Message 1 of 1 in “cogito: commit message from stdin and -m switch”
  1. Gerrit PapeJan 2, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.