All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	Sebastian Pipping <webmaster@hartwork.org>,
	Git ML <git@vger.kernel.org>
Subject: Re: "git add -u" broken in git 1.7.4?
Date: Mon, 07 Feb 2011 09:27:14 +0100	[thread overview]
Message-ID: <4D4FACE2.4060206@drmicha.warpmail.net> (raw)
In-Reply-To: <vpqbp2ojq5x.fsf@bauges.imag.fr>

Matthieu Moy venit, vidit, dixit 07.02.2011 07:48:
> Jeff King <peff@peff.net> writes:
> 
>> On Sun, Feb 06, 2011 at 09:50:37PM -0800, Junio C Hamano wrote:
>>
>>> As it takes pathspecs (think "git add -u this-file"), it fundamentally
>>> shouldn't be tree-wide.  I think the original implementation didn't take
>>> pathspecs and was mistakenly done as tree-wide operation, but I think it
>>> was fixed rather quickly.
>>
>> Is "git add -p" broken, then? It takes pathspecs relative to the current
>> directory, but "git add -p" without arguments operates from the root,
>> not from the current subdirectory.
> 
> It's not just "git add -p". Take "git log", "git status", "git
> commit", "git diff" ... well, most Git commands taking pathspecs
> optionally:
> 
> git foo   => tree-wide
> git foo . => the . acts as a path limiter
> 
> and this is the right thing to do. Making "git foo" equivalent to "git
> foo ." makes it hard to recover the tree-wide behavior from a
> subdirectory (git foo ../../../).
> 

First of all, I'd vote for having this work the same way across all
commands - as Junio explained, the destinction we currently have is not
easy to grasp, and is violated by add -p.

Second, we have an established, natural syntax for "base on cwd", namely
".", but we do not have any for "base on worktree root". (I think we
discussed and discarded "/" at some point.)

So, if we go for "relative to cwd by default" we would need a simple way
to specify the root - and by simple I mean taking at most 2 chars in the
pathspec, not a long option!

In summary, I think going for "relative to worktree root by default" is
more in line with git's overall philosophy (so it teaches the right
concept), something the user is exposed to already in most places (but
not all), and limiting to "." already works in most (all?) places, even
with "status" and "status -s". We would only need to change the few
places where we still default to cwd, and make sure they accept "." when
we change their default to repo root.

Cheers,
Michael

  reply	other threads:[~2011-02-07  8:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06  0:39 "git add -u" broken in git 1.7.4? Sebastian Pipping
2011-02-06  5:13 ` Jeff King
2011-02-06 19:35   ` Sebastian Pipping
2011-02-06 20:48     ` Matthieu Moy
2011-02-06 23:19       ` SZEDER Gábor
2011-02-06 23:49         ` Sebastian Pipping
2011-02-07  5:50       ` Junio C Hamano
2011-02-07  5:53         ` Jeff King
2011-02-07  6:46           ` Junio C Hamano
2011-02-07  7:29             ` Nguyen Thai Ngoc Duy
2011-02-07 18:34             ` SZEDER Gábor
2011-02-07 19:31               ` Junio C Hamano
2011-02-07 19:50             ` Jeff King
2011-02-08 10:05               ` SZEDER Gábor
2011-02-09 21:03                 ` Jeff King
2011-02-09 22:40                   ` Junio C Hamano
2011-02-09 23:46                     ` Jeff King
2011-02-10  2:24                       ` Nguyen Thai Ngoc Duy
2011-02-10  2:31                         ` Jeff King
2011-02-10  2:46                           ` Junio C Hamano
2011-02-10  7:46                       ` Johannes Sixt
2011-02-10  8:13                       ` Joshua Juran
2011-02-10 18:00                       ` Matthieu Moy
2011-02-15  7:04                       ` [PATCH] command-list.txt: mark git-archive plumbing Nguyen Thai Ngoc Duy
2011-02-15 19:11                         ` Junio C Hamano
2011-02-16  9:32                           ` Nguyen Thai Ngoc Duy
2011-02-07 20:57             ` "git add -u" broken in git 1.7.4? Matthieu Moy
2011-02-07 21:02               ` Jeff King
2011-02-07 21:49                 ` Junio C Hamano
2011-02-08  1:25             ` Eric Raible
2011-02-08  2:16               ` Junio C Hamano
2011-02-07  6:48           ` Matthieu Moy
2011-02-07  8:27             ` Michael J Gruber [this message]
2011-02-07 11:15         ` SZEDER Gábor

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=4D4FACE2.4060206@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=webmaster@hartwork.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.