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

Re: fatal: ambiguous message

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 2, 2011, 18:34 UTC
Message-ID
<20110102183453.GA13463@burratino>
In-Reply-To
<4D20BE0B.6040104@gmail.com>
Hi,
Context: http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=build-aux/git-version-gen
Bruce Korb wrote:
>                          So, this message says, "fatal: ..."
> and comes from git and all three "git" invocations redirect stderr to
> /dev/null.  The fact that we see it is a git bug.  Error messages
> should be directed to stderr and thus written to /dev/null.
Were you been able to reproduce that outside the script?
> So, git-version-gen is correct to continue, but git should fail
> with a message that names the program that fails ("git") and
> should direct the message to stderr.

No thoughts on this part. git has at least four kinds of message it sends to stderr (fatal:, warning:, error:, and usage:) but I am not sure it is useful to distinguish them ---

	git add: pathspec 'nonsense' did not match any files
might be nicer.
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 5617eb8..119d7aa 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -119,7 +119,7 @@ then
 	    # result is the same as if we were using the newer version
 	    # of git describe.
 	    vtag=`echo "$v" | sed 's/-.*//'`
-	    numcommits=`git rev-list "$vtag"..HEAD | wc -l`
+	    numcommits=`git rev-list "$vtag"..HEAD 2>/dev/null | wc -l`
 	    v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
 	    ;;
     esac
Previous: Bruce KorbNext: Bruce Korb
Message 2 of 4 in “Re: fatal: ambiguous message”
  1. Bruce KorbJan 2, 2011
  2. Jonathan NiederJan 2, 2011
  3. Bruce KorbJan 3, 2011
  4. Eric BlakeJan 3, 2011

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.