Thread (1 message) 1 message, 1 author, 2016-06-15

Re: What's cooking in git.git (Apr 2013, #05; Mon, 15)

From: Thomas Rast <hidden>
Date: 2016-06-15 22:56:52

Junio C Hamano [off-list ref] writes:
* jc/add-2.0-delete-default (2013-03-08) 3 commits
 - git add <pathspec>... defaults to "-A"
  (merged to 'next' on 2013-04-05 at 199442e)
 + git add: start preparing for "git add <pathspec>..." to default to "-A"
 + builtin/add.c: simplify boolean variables

 In Git 2.0, "git add pathspec" will mean "git add -A pathspec".  If
 you did this in a working tree that tracks dir/lost and dir/another:

 $ rm dir/lost
 $ edit dir/another
 $ git add dir

 The last step will not only notices and records updated
 dir/another, but also notices and records the removal of dir/lost
 in the index.

 Start training the users for this change to say --no-all when they
 want to ignore the removal to smooth the transition hump.

 Will merge to 'master' the early bits and cook the rest in 'next' until Git 2.0.
The warning triggers in some cases where it shouldn't, relating to
submodules:

  $ git submodule add gitosis@git.csa.inf.ethz.ch:domjudge.git domjudge
  Adding existing repo at 'domjudge' to the index                                                        
  warning: In Git 2.0, 'git add <pathspec>...' will also update the                                      
  index for paths removed from the working tree that match                                               
  the given pathspec. If you want to 'add' only changed                                                  
  or newly created paths, say 'git add --no-all <pathspec>...' instead.

It also seems to hint that the problem is with giving a 'pathspec', but
in fact in the case of a "proper" pathspec (that isn't an existing path)
it does *not* trigger, even though it probably should:

  $ git ls-files
  foo
  $ rm foo
  $ git add 'f*'
  $ git status
  # On branch master
  # Changes not staged for commit:
  #   (use "git add/rm <file>..." to update what will be committed)
  #   (use "git checkout -- <file>..." to discard changes in working directory)
  #
  #       deleted:    foo
  #
  no changes added to commit (use "git add" and/or "git commit -a")
  $ git add -A 'f*'
  $ git status
  # On branch master
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
  #       deleted:    foo
  #
  # Untracked files not listed (use -u option to show untracked files)

That's of course assuming that you want to unconditionally make -A the
default.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help