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

Re: [PATCH RFC] git describe without refs distinguishes dirty working tree

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 16, 2009, 22:37 UTC
Message-ID
<20091016223742.GV10505@spearce.org>
In-Reply-To
<dffdbd190910161452o4ac0b426i7c48649eafa0d53@mail.gmail.com>
Jean Privat <jean@pryen.org> wrote:
> > I still haven't heard anything that helps me to decide which way the
> > default should be.  The only concrete thing I have heard against the
> > change of the default is that it will break existing setup, but I haven't
> > heard anything concrete for the change yet.
...
Show 6 quoted lines
> Then, I realized that for some other git commands that can work both
> on the working tree and on an arbitrary commit reference, the default
> was to work on the working tree and require an explicit HEAD to work
> on the HEAD commit. Thus it makes sense to me that "git describe"
> alone should describe the working tree and that "git describe HEAD"
> should describe the HEAD commit.

Yup. That's my take on it too. This default of "no argument means describe the working tree" matches with tools like `git diff`, `git checkout`, `git status`, `git blame` with no revision arguments.

We are being blasted by users for being inconsistent in our UI in too many places. Here's yet another. We need to start standardizing on a more consistent UI model. If that model means we need to use a "--worktree" flag to mean "against the working tree" then we should start doing that also to `git status`, `git checkout`, `git blame`, and `git diff`.

>  $ git describe --dirty v1.2.1
> should it show an error, output "v1.2.1" anyway, or output
> "v1.2.1-dirty" if the working tree is different from v1.2.1 ?

IMHO, that should be a fatal usage error, if we go that approach. I would also argue `git describe --dirty HEAD` is equally fatal.

-- 
Shawn.
Previous: Jean PrivatNext: Junio C Hamano
Message 6 of 8 in “git describe without refs distinguishes dirty working tree”
  1. git describe without refs distinguishes dirty working treeJean Privat, Oct 16, 2009
  2. Junio C HamanoOct 16, 2009
  3. Shawn O. PearceOct 16, 2009
  4. Junio C HamanoOct 16, 2009
  5. Jean PrivatOct 16, 2009
  6. Shawn O. PearceOct 16, 2009
  7. Junio C HamanoOct 16, 2009
  8. Nicolas PitreOct 17, 2009

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.