* Any way to edit the file in index directly?
@ 2009-04-08 1:03 Ping Yin
2009-04-08 2:10 ` Jeff King
0 siblings, 1 reply; 7+ messages in thread
From: Ping Yin @ 2009-04-08 1:03 UTC (permalink / raw)
To: git mailing list
There seems to be a patch for this ( add -e?), but i forget where to find it.
For a big change, instead of "add -p", it may be easier to edit the
index directly ( with the corresponding worktree file alongside)
Ping Yin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 1:03 Any way to edit the file in index directly? Ping Yin
@ 2009-04-08 2:10 ` Jeff King
2009-04-08 2:16 ` Jeff King
2009-04-08 2:39 ` Johannes Schindelin
0 siblings, 2 replies; 7+ messages in thread
From: Jeff King @ 2009-04-08 2:10 UTC (permalink / raw)
To: Ping Yin; +Cc: git mailing list
On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
> There seems to be a patch for this ( add -e?), but i forget where to
> find it.
"add -p" has an "e"dit option for editing the patch. I don't recall any
way of directly editing the content.
> For a big change, instead of "add -p", it may be easier to edit the
> index directly ( with the corresponding worktree file alongside)
I'm not sure what you mean by "alongside". If you mean "by editing a
temporary file that corresponds to the index file without munging your
worktree file", then you can do:
FILE=foo.c
git show :$FILE >$FILE.tmp
$EDITOR $FILE.tmp
object=`git hash-object -w $FILE.tmp`
git update-index --cacheinfo 100644 $object $FILE
And obviously you could make a script for that if you wanted (but at the
very least, you would need quotes to handle files with spaces, and
probably some magic to handle smudge/clean filters and CRLF properly for
the tempfile).
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 2:10 ` Jeff King
@ 2009-04-08 2:16 ` Jeff King
2009-04-08 2:27 ` Ping Yin
2009-04-08 2:39 ` Johannes Schindelin
1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2009-04-08 2:16 UTC (permalink / raw)
To: Ping Yin; +Cc: git mailing list
On Tue, Apr 07, 2009 at 10:10:41PM -0400, Jeff King wrote:
> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>
> > There seems to be a patch for this ( add -e?), but i forget where to
> > find it.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
Hmm, actually maybe you are thinking of:
http://article.gmane.org/gmane.comp.version-control.git/103389
which I even reviewed, but it doesn't seem to have gone anywhere after
that.
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 2:16 ` Jeff King
@ 2009-04-08 2:27 ` Ping Yin
2009-04-08 5:44 ` Markus Heidelberg
0 siblings, 1 reply; 7+ messages in thread
From: Ping Yin @ 2009-04-08 2:27 UTC (permalink / raw)
To: Jeff King; +Cc: git mailing list
Ping Yin
On Wed, Apr 8, 2009 at 10:16 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Apr 07, 2009 at 10:10:41PM -0400, Jeff King wrote:
>
>> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>>
>> > There seems to be a patch for this ( add -e?), but i forget where to
>> > find it.
>>
>> "add -p" has an "e"dit option for editing the patch. I don't recall any
>> way of directly editing the content.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
Sometimes by 'add -p', i can't get what i want (the patch will fail to
apply when exiting editor). And with 'add -p', i can't get a global
view of all changes together
> I'm not sure what you mean by "alongside".
By "aloneside" i mean i can open the index and worktree file in diff
mode side by side for easily editing.
> Hmm, actually maybe you are thinking of:
>
> http://article.gmane.org/gmane.comp.version-control.git/103389
>
> which I even reviewed, but it doesn't seem to have gone anywhere after
> that.
>
Thanks, That's what i want.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 2:10 ` Jeff King
2009-04-08 2:16 ` Jeff King
@ 2009-04-08 2:39 ` Johannes Schindelin
2009-04-08 4:17 ` Ping Yin
1 sibling, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2009-04-08 2:39 UTC (permalink / raw)
To: Jeff King; +Cc: Ping Yin, git mailing list
Hi,
On Tue, 7 Apr 2009, Jeff King wrote:
> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>
> > There seems to be a patch for this ( add -e?), but i forget where to
> > find it.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
I posted a patch for "git add --edit", which allows you to edit the _diff_
between the working directory and the index, and which applies the result
using apply --recount.
But that has nothing to do with "editing the index directly".
But you might want to use a combination of "hash-object -w --stdin" and
"update-index --cacheinfo". IOW something like
sha1=$(echo Hello | git hash-object -w --stdin) &&
git update-index --cacheinfo 0644 $sha1 my-file
However, Ping, I _strongly_ suspect an X-Y problem here. IOW I think you
are asking about specifics of a certain _solution_, while we probably have
a better solution for your particular _problem_.
Hth,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 2:39 ` Johannes Schindelin
@ 2009-04-08 4:17 ` Ping Yin
0 siblings, 0 replies; 7+ messages in thread
From: Ping Yin @ 2009-04-08 4:17 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jeff King, git mailing list
On Wed, Apr 8, 2009 at 10:39 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 7 Apr 2009, Jeff King wrote:
>
>> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>>
>> > There seems to be a patch for this ( add -e?), but i forget where to
>> > find it.
>>
>> "add -p" has an "e"dit option for editing the patch. I don't recall any
>> way of directly editing the content.
>
> I posted a patch for "git add --edit", which allows you to edit the _diff_
> between the working directory and the index, and which applies the result
> using apply --recount.
>
> But that has nothing to do with "editing the index directly".
>
> But you might want to use a combination of "hash-object -w --stdin" and
> "update-index --cacheinfo". IOW something like
>
> sha1=$(echo Hello | git hash-object -w --stdin) &&
> git update-index --cacheinfo 0644 $sha1 my-file
>
> However, Ping, I _strongly_ suspect an X-Y problem here. IOW I think you
> are asking about specifics of a certain _solution_, while we probably have
> a better solution for your particular _problem_.
>
Thanks. I think 'add --edit' is just what i meant by saying 'add -e'.
I'll have it a try.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Any way to edit the file in index directly?
2009-04-08 2:27 ` Ping Yin
@ 2009-04-08 5:44 ` Markus Heidelberg
0 siblings, 0 replies; 7+ messages in thread
From: Markus Heidelberg @ 2009-04-08 5:44 UTC (permalink / raw)
To: Ping Yin; +Cc: Jeff King, git mailing list
Ping Yin, 08.04.2009:
> On Wed, Apr 8, 2009 at 10:16 AM, Jeff King <peff@peff.net> wrote:
> > I'm not sure what you mean by "alongside".
>
> By "aloneside" i mean i can open the index and worktree file in diff
> mode side by side for easily editing.
This is possible with git-difftool from the contrib/ area, but without
editing the index file.
But I think "worktree" is called "worktree" for a good reason.
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-08 5:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 1:03 Any way to edit the file in index directly? Ping Yin
2009-04-08 2:10 ` Jeff King
2009-04-08 2:16 ` Jeff King
2009-04-08 2:27 ` Ping Yin
2009-04-08 5:44 ` Markus Heidelberg
2009-04-08 2:39 ` Johannes Schindelin
2009-04-08 4:17 ` Ping Yin
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).