From: Linus Torvalds <torvalds@osdl.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: selective git-update-index per diff(1) chunks
Date: Fri, 1 Dec 2006 08:06:32 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612010740160.3695@woody.osdl.org> (raw)
In-Reply-To: <b6fcc0a0612010323x7554e47m5e6bdafe85fc8224@mail.gmail.com>
On Fri, 1 Dec 2006, Alexey Dobriyan wrote:
>
> Has anyone thought about aggregating this into git-update-index or
> somewhere?
>
> git-update-index -C1,3 #chunks 1, 3
> git commit
You can already do it, but it's called something else.
Instead of updating a certain hunk (which is fundamentally wrong, since it
depends on "diff" even working on that file), you can tell
git-update-index to update a certain _state_ for an arbitrary number of
files. Namely:
git-update-index [--cacheinfo <mode> <object> <file>]*
However, that obviously is very much a _plumbing_ command, and you need to
have some higher-level GUI on top of it to actually pick out the chunks
(if that is what you want) and generate the object(s) associated with the
file(s) with only those chunks and then do the above "install this state
into the index/staging area/whatever".
In other words, git already supports this on a _technical_ level, but does
not have the high-level interfaces for it, and quite frankly
"git-update-index" _shouldn't_ have the high-level interfaces for it. It's
designed to be the low-level technology, not the actual interface.
I think it's more appropriate for a GUI front-end, frankly, but you could
script it fairly easily with whatever your favourite patch editing tool:
(a) Generate the "result" file you want in /tmp or something, using patch
editing tools to extract a partial patch and apply it to the original
file.
(b) Use "git-hash-object" to create the backing store object, and get the
SHA1 for that file.
(c) Use "git-update-index --cacheinfo <mode> <sha1> <filename>" to
populate that new entry of yours into the index.
(d) Do (a)-(c) as many times as you like to handle all the files you
want to commit, and then just call "git commit"
iow, it's not hard, but no, git on its own is _not_ a patch-based system,
and doesn't do things hunk-for-hunk. You need that "hunk selector"
interface on top of it.
next prev parent reply other threads:[~2006-12-01 16:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-01 11:23 selective git-update-index per diff(1) chunks Alexey Dobriyan
2006-12-01 11:33 ` Peter Baumann
2006-12-01 11:38 ` Junio C Hamano
2006-12-01 16:45 ` Anand Kumria
2006-12-01 19:42 ` Johannes Schindelin
2006-12-02 21:08 ` Sam Vilain
2006-12-01 16:06 ` Linus Torvalds [this message]
2006-12-04 17:33 ` Sven Verdoolaege
2006-12-04 18:05 ` Jakub Narebski
[not found] ` <20061204202102.GH940MdfPADPa@greensroom.kotnet.org>
2006-12-04 20:46 ` Jakub Narebski
2006-12-04 21:51 ` Sven Verdoolaege
2006-12-04 22:35 ` Jakub Narebski
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=Pine.LNX.4.64.0612010740160.3695@woody.osdl.org \
--to=torvalds@osdl.org \
--cc=adobriyan@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).