Git development
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	David Symonds <dsymonds@gmail.com>,
	git@vger.kernel.org, gitster@pobox.com,
	Stephan Beyer <s-beyer@gmx.net>
Subject: Re: [PATCH] git-diff: Add --staged as a synonym for --cached.
Date: Sun, 2 Nov 2008 13:35:19 +0100	[thread overview]
Message-ID: <20081102123519.GA21251@atjola.homenet> (raw)
In-Reply-To: <20081029171122.GA12167@sigill.intra.peff.net>

On 2008.10.29 13:11:22 -0400, Jeff King wrote:
> On Wed, Oct 29, 2008 at 06:06:09PM +0100, Johannes Schindelin wrote:
> 
> > However, note that we have to hash out what to do about the convention 
> > that --cached traditionally means that only the staging area (formerly 
> > known as "the index") is affected, while --index means that the command 
> > touches the working directory, too.
> 
> If we assume that we have only the word "stage" and variations
> available, then there aren't too many options.
> 
>   only the staging area:
>     --stage-only, --staged-only
> 
>   both:
>     --staged (as opposed to --staged-only) --stage-and-worktree (too
>     long), --both (not descriptive enough), --stage-too (yuck)

Hm, I don't think that would work out nicely with stash. --keep-index
would become --keep-staged-only, which is IMHO pretty confusing, as the
default is to keep nothing. And even if you add another option to keep
all changes, so that the current state is just put onto the stash, but
the working tree and index are unchanged, you would have --keep-staged
and --keep-staged-only. Not really any better.

Admittedly, --keep-index is quite different from --index, but if you're
going to change the CLI to hide the word "index", that option needs to
be changed as well and the usage of the new terms should be unified.

Looking at --cached/--index we have basically three things:

  --cached to refer to the state of the index (diff, grep, [stash], ...)
  --cached to _work on_ the index only (rm, apply, ...)
  --index to _work on_ both the index and the working tree (apply, ...)

Maybe that could be translated to:

  --staged: refer to the state of the index
  --stage: in addition to changing the working tree, also stage the changes
  --stage-only: only stage the changes, don't change the working tree

That would give us, for example:
git diff --staged
git grep --staged

git apply --stage
git apply --stage-only
git rm --stage-only

git stash --keep-staged

A quick look through Documentation/ revealed only one problematic case,
which is ls-files that already has a --stage option. And that looks like
a dealbreaker :-(

Björn

  parent reply	other threads:[~2008-11-02 12:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 16:15 [PATCH] git-diff: Add --staged as a synonym for --cached David Symonds
2008-10-29 16:42 ` Jeff King
2008-10-29 16:50   ` David Symonds
2008-10-29 17:06     ` Johannes Schindelin
2008-10-29 17:11       ` Jeff King
2008-11-02  8:30         ` Junio C Hamano
2008-11-03  7:04           ` Jeff King
2008-11-02 12:35         ` Björn Steinbrink [this message]
2008-11-02 18:30           ` Junio C Hamano
2008-11-02 18:54             ` Björn Steinbrink
2008-11-03  7:14             ` Jeff King
2008-11-10 23:37               ` David Symonds
2008-11-11  0:15                 ` Jeff King
2008-11-11  1:11                 ` Junio C Hamano
2008-11-11  1:22                   ` Jeff King
2008-11-12  0:57                     ` Junio C Hamano
2008-11-11  4:04               ` Avery Pennarun
2008-11-11  5:49                 ` Miles Bader
2008-11-12  8:33                 ` Jeff King
2008-11-12 11:10                   ` Johannes Schindelin
2008-11-12 11:06                     ` Jeff King
2008-11-12 15:39                       ` Avery Pennarun
2008-11-12 19:15                         ` Jeff King
2008-11-12 19:29                           ` Junio C Hamano
2008-11-12 19:37                             ` Jeff King
2008-11-12 19:57                               ` Junio C Hamano
2008-11-12 22:39                                 ` Avery Pennarun
2008-11-12 23:42                                   ` Junio C Hamano
2008-11-12 15:46                     ` Avery Pennarun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081102123519.GA21251@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dsymonds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=s-beyer@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox