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

Re: [PATCH] RFC - Say goodbye to the rodent

From
Jeff King <peff@peff.net>
Date
Aug 5, 2009, 19:02 UTC
Message-ID
<20090805190256.GA9004@coredump.intra.peff.net>
In-Reply-To
<1249465906-3940-1-git-send-email-ayiehere@gmail.com>
On Wed, Aug 05, 2009 at 05:51:40PM +0800, Nazri Ramliy wrote:
> The idea is that "git status --id" shows a unique id for each file in
> its output (modified/staged/unknown/etc). The ids and the
> corresponding filenames are stored in .git/FILE_IDS. This file gets
> overwritten everytime you run "git status --id"

But files _already_ have a unique id: the filename. You never say why those unique ids must be cut-and-pasted using the mouse when your unique ids would be suitable for typing, but I'll assume it's because your unique ids are much shorter than your filenames.

There are already two classes of solutions to this problem:
  1. Make typing the filenames easier. Generally, this is accomplished
     by tab completion. Even stock bash (and other shells) should
     complete filenames easily, but you can also complete much more
     using the programmable bash completion included with git.
     The main advantage of this approach is that it is totally
     generalizable. Anytime you have to input a filename, you can use
     it.
  2. Structure your workflow to iterate over the list of items to be
     acted on, and then select actions for each item. This is what "git
     add -i" does, as well as "git mergetool" and "git difftool".
     This can save a lot of typing over (1), but requires a new script
     for every such workflow (e.g., the scripts above cover only adding,
     resolving merges, and diffing; you would need a new script to
     iterate over files, doing "git checkout" on each one, for example).

I think your solution is a third class, which is to assign a mapping of shorter ids to items that persists over multiple commands. But it's not clear to me where it has an advantage over the existing two solutions. It is actually less general than (1), because you have to have assigned the mappings beforehand. But it is not nearly as convenient as (2).

In addition, it's more complicated to implement and use, because you have to care about the persistence of the mapping (i.e., how long does it last, which commands reset it, etc).

So while it is somewhat clever, I don't think it is worth merging to mainline git; it introduces complexity to solve a problem that already has overlapping solutions.

-Peff
Previous: Matthieu MoyNext: Nicolas Pitre
Message 16 of 17 in “RFC - Say goodbye to the rodent”
  1. RFC - Say goodbye to the rodentNazri Ramliy, Aug 5, 2009
  2. 1/6 Teach --id/-d to "git status"Nazri Ramliy, Aug 5, 2009
  3. 2/6 Teach --id to "git add"Nazri Ramliy, Aug 5, 2009
  4. 3/6 Teach --id to "git checkout"Nazri Ramliy, Aug 5, 2009
  5. 4/6 Teach --d to "git commit"Nazri Ramliy, Aug 5, 2009
  6. 5/6 Teach --id to "git rm"Nazri Ramliy, Aug 5, 2009
  7. 6/6 Teach --id to "git reset"Nazri Ramliy, Aug 5, 2009
  8. Alex RiesenAug 5, 2009
  9. Sverre RabbelierAug 5, 2009
  10. Junio C HamanoAug 5, 2009
  11. Sverre RabbelierAug 5, 2009
  12. Alex RiesenAug 5, 2009
  13. Sverre RabbelierAug 5, 2009
  14. Andreas EricssonAug 5, 2009
  15. Matthieu MoyAug 5, 2009
  16. Jeff KingAug 5, 2009
  17. Nicolas PitreAug 5, 2009

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.