Re: way to automatically add untracked files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 06 August 2007, Jakub Narebski wrote:
> Johan Herland wrote:
> 
> > So different users seem to have two different (almost incompatible) 
> > expectations to git-add:
> > 
> > 1. git-add adds new files into the index. git-add has _no_ business removing 
> > deleted files from the index.
> > 
> > 2. git-add updates the index according to the state of the working tree. 
> > This includes adding new files and removing deleted files.
> > 
> > 
> > Both interpretations are useful and worth supporting, but git-add currently 
> > seems focused on #1 (and rightly so, IMHO).
> > 
> > Even though #2 can be achieved by using a couple of git-add commmands (or a 
> > longer series of more obscure plumbing-level commands), it might be worth 
> > considering the more user-friendly alternative of adding a dedicated 
> > command for supporting #2. Such a command already exists in a similar RCS:
> > 
> > ---
> > $ hg addremove --help
> > hg addremove [OPTION]... [FILE]...
> > 
> > add all new files, delete all missing files
> 
> git update-index --add --remove?

This is actually the nicest looking command I've seen so far in this thread.
It's reasonably simple to deduce what it does, or rather, should do...

Of course it has some shortcomings:

- It only works on individual files. Supplying a directory (subdir or '.')
  is not supported.

- It _seems_ to not support .gitignore, i.e. new files that are already in
  .gitignore give the same feedback (add 'foo') as new files that are not
  ignored. But when you commit, the ignored files will in fact _not_ be
  committed (which is correct, AFAICS). It would be nice if git-update-index
  told me that up front.

Of course, It may be that git-update-index is too low-level (i.e. plumbing)
to support the above use case in a user-friendly fashion. In that case, feel
free to ignore the above issues.


Have fun!

...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux