From: Nazri Ramliy <ayiehere@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] RFC - Say goodbye to the rodent
Date: Wed, 5 Aug 2009 17:51:40 +0800 [thread overview]
Message-ID: <1249465906-3940-1-git-send-email-ayiehere@gmail.com> (raw)
Hello list,
Git status provides a list of modified/staged files etc.
Normally I use the mouse to cut and paste the filenames in subsequent git
operations.
Oftentimes I get tired of moving my hand away from the comfort of the home rows
of my keybard in order to grab the mouse to highlight the files that I'd like
to operate on.
This patch is my attempt at scratching this itch. It is, at best, works fine;
albeit a little bit experimental. I may have overlooked a dozen things -
variable names, places where I define the variables etc. If people find this useful
I'll look into polishing the code. All seem to work well. Running make test
does not break anything. I have not written test case for them.
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"
Subsequent git operations can be taught to accept the --id command line option
to tell them what files to operate on. They will read the FILE_IDS to find out
which file to operate based on the given id. In the patch series I have taught
the add, checkout, commit, rm and reset commands the --id option.
Example:
$ git status --id
# On branch local
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: builtin-write-tree.c (m1)
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# file1.c (x1)
# file2.c (x2)
Note the id at the end of the files.
Now we can do the following:
$ git add --id m1
Ids are specified via the --id command line option, and can be separated with
commas if you want to specify more than one of them:
$ git add --id m1,x2
You get the idea ...
What do you guys think about this new approach of "cut-and-paste" from the
command line?
Where would be the best place to put the file id? end? beginning? before ':'?
The argument to --id could be improved so that it understand regexes for file ids.
Comments are welcomed.
Nazri.
--
builtin-add.c | 19 +++++--
builtin-checkout.c | 26 ++++++---
builtin-commit.c | 4 +-
builtin-reset.c | 32 +++++++----
builtin-rm.c | 11 ++++-
cache.h | 1 +
path.c | 44 ++++++++++++++++
wt-status.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++++----
wt-status.h | 1 +
9 files changed, 245 insertions(+), 39 deletions(-)
next reply other threads:[~2009-08-05 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 9:51 Nazri Ramliy [this message]
2009-08-05 9:51 ` [PATCH 1/6] Teach --id/-d to "git status" Nazri Ramliy
2009-08-05 9:51 ` [PATCH 2/6] Teach --id to "git add" Nazri Ramliy
2009-08-05 9:51 ` [PATCH 3/6] Teach --id to "git checkout" Nazri Ramliy
2009-08-05 9:51 ` [PATCH 4/6] Teach --d to "git commit" Nazri Ramliy
2009-08-05 9:51 ` [PATCH 5/6] Teach --id to "git rm" Nazri Ramliy
2009-08-05 9:51 ` [PATCH 6/6] Teach --id to "git reset" Nazri Ramliy
2009-08-05 18:11 ` [PATCH 1/6] Teach --id/-d to "git status" Alex Riesen
2009-08-05 18:25 ` Sverre Rabbelier
2009-08-05 18:27 ` Junio C Hamano
2009-08-05 18:30 ` Sverre Rabbelier
2009-08-05 18:33 ` Alex Riesen
2009-08-05 18:35 ` Sverre Rabbelier
2009-08-05 10:04 ` [PATCH] RFC - Say goodbye to the rodent Andreas Ericsson
2009-08-05 11:54 ` Matthieu Moy
2009-08-05 19:02 ` Jeff King
2009-08-05 20:01 ` Nicolas Pitre
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=1249465906-3940-1-git-send-email-ayiehere@gmail.com \
--to=ayiehere@gmail.com \
--cc=git@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).