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

Re: [PATCH/WIP] completion: complete git diff with only changed files.

From
Paul Ebermann <paul-ebermann@gmx.de>
Date
May 19, 2011, 12:31 UTC
Message-ID
<4DD50DA9.8010305@gmx.de>
In-Reply-To
<7voc2zbwz8.fsf@alter.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 12 quoted lines
> Paul Ebermann <Paul-Ebermann@gmx.de> writes:
> 
>> I'm normally using (for differences to head) git status first, and then
>> have a look at the files I really want to see. Then completion of only
>> the changed files seems useful.
> 
> By the time completion offers you the choices, you already have spent
> enough extra cycles to compute the paths, which is half the cost of
> generating the diff itself.
> 
> I have this nagging feeling that you are trying to solve a problem that
> does not exist.
Maybe.

For me, it is not so much about saving CPU cycles (I have enough of these) but about not seeing things I don't want to see, and helping me decide what to type. This might be against the Git philosophy, I'm starting to realize.

>  Perhaps you have too many things going on in your working
> tree at once, and if git helped in such a way that your workflow does not
> have to touch so many (possibly unrelated) things at once, you do not have
> to worry about unconstrained "git diff" output overwhelming you?

If I only want to do "git diff" (without any paths), I obviously don't need path completion at all.

Here is an example:
Yesterday, I addes a new Java class (193 lines)
  src/de/hub/sam/es/managementclient/ssh/TunnelSocketImpl.java
and at the same time made some changes to
  src/de/hub/sam/es/managementclient/ssh/ConnectionManager.java
to use this new class (adding 29 lines).
I wanted to look only at the changes made to ConnectionManager.java.

(The changes to TunnelSocketImpl.java were obvious: creating the whole new class, thus I could look at this in my editor if I wanted).

With the usual filename-completion, this goes like
    git diff -- s<tab><tab><tab><tab><tab><tab>s<tab>C<tab>

If I had a broader package tree (like in some other projects), it takes even more work, as I must remember which package name starting letters to type between the tabs.

(In some projects I started to choose the package names so that there never would be two sibling directories starting with the same letter, to help autocompletion.)

With the new completion scheme, this would be
   git diff -- <tab>C<tab>

It might need doubled time to complete-and-execute, but my computer is quite faster than I can type (and think), even if the .git directory is on a NFS.

(You could ask why my shell working directory is not the
 managementclient directory. The reason is that sometimes
 there are files in ./ which get changed, too.)
Paul
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “completion: complete git diff with only changed files.”
  1. completion: complete git diff with only changed files.Paul Ebermann, May 18, 2011
  2. Junio C HamanoMay 18, 2011
  3. Paul EbermannMay 18, 2011
  4. Junio C HamanoMay 18, 2011
  5. Paul EbermannMay 19, 2011
  6. Junio C HamanoMay 19, 2011

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.