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

Re: [PATCHv2] git-diff: Clarify operation when not inside a repository.

From
Dale R. Worley <worley@alum.mit.edu>
Date
Aug 23, 2013, 18:11 UTC
Message-ID
<201308231811.r7NIBeH9027848@freeze.ariadne.com>
In-Reply-To
<xmqqioyxqwdr.fsf@gitster.dls.corp.google.com>
> From: Junio C Hamano <gitster@pobox.com>
Show 21 quoted lines
> I suspect that it may be a good idea to split the section altogether
> to reduce confusion like what triggered this thread, e.g.
> 
>     'git diff' [--options] [--] [<path>...]::
> 
>             This form is to view the changes you made relative to
>             the index (staging area for the next commit).  In other
>             words, the differences are what you _could_ tell Git to
>             further add to the index but you still haven't.  You can
>             stage these changes by using linkgit:git-add[1].
> 
>     'git diff' --no-index [--options] [--] <path> <path>::
> 
> 	    This form is to compare the given two paths on the
> 	    filesystem.  When run in a working tree controlled by
> 	    Git, if at least one of the paths points outside the
> 	    working tree, or when run outside a working tree
> 	    controlled by Git, you can omit the `--no-index` option.
> 
> For now, I'll queue your version as-is modulo style fixes, while
> waiting for others to help polishing the documentation better.

It'd difficult to figure out how to describe it well. In my opinion, the problem here is the DWIM nature of the command, which means that there is a lot of interaction between the options that are specified, the number of path arguments, and the circumstances. My preference is for "do what I say", that the options restrict the command to operate in exactly one way, which determines the way the paths are used (and thus their number) and the context in which it can be used. But that's not how git-diff works.

Dale
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “git-diff: Clarify operation when not inside a repository.”
  1. git-diff: Clarify operation when not inside a repository.Dale R. Worley, Aug 21, 2013
  2. Junio C HamanoAug 21, 2013
  3. [PATCHv2] git-diff: Clarify operation when not inside a repository.Dale R. Worley, Aug 22, 2013
  4. Junio C HamanoAug 22, 2013
  5. Dale R. WorleyAug 23, 2013
  6. Junio C HamanoAug 28, 2013
  7. Dale R. WorleyAug 29, 2013

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.