* clarification on git-update-index --remove
@ 2007-01-04 19:29 David Tweed
2007-01-04 20:27 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: David Tweed @ 2007-01-04 19:29 UTC (permalink / raw)
To: git
Hi, can someone who understands the index in git please clarify something
for me? Looking at the documentation it's not totally clear which entites
are referred to by "removed" and what that then implies.
from git-1.4.4.3/Documentation/git-update-index.txt <<<<<<<<<<<
--remove::
If a specified file is in the index but is missing then it's
removed.
Default behavior is to ignore removed file.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I currently take this to mean
"With --remove, if there is a filepath in the index
and that filepath is in the list of files being fed to this instance
of git-update-index but in the working directory tree that filepath
does not currently exist, then upon termination remove the
filepath's record from the index.
[This means at the next commit it will not be present
at all in the set of files recorded via this commit.]
Default behaviour in that situation is to leave the index's
current record unaltered.
[This means that that filename will be, upon a commit,
recorded as having whatever sha-content the index currently records
it as having.]"
If this reading is right, this means that I have to pass the names of
files that have been removed otherwise they'll stay with their "last
contents before removal"? I'm currently finding removed files
"stay around in snapshots with their ultimate contents", and I now
_think_ this is the reason but I'm not sure.
(In case anyone's wants to know the context, I traced through and
distilled git-commit.sh to what I think
I need (rexpressed in python) with the core "make snapshot" code being
<<<<<<<<<<<<<<<<
p1=loggedPopen(["git-update-index","-z","--add","--remove","--stdin"],
stdin=PIPE)
for (d,fs) in files.iteritems(): # enters only "to be recorded" items
for f in fs:
p1.stdin.write(os.path.join(d,f)+"\0")
p1.stdin.close()
p1.wait()
tree=loggedPopen(["git-write-tree"],stdout=PIPE).communicate()[0].rstrip()
commit=loggedPopen(["git-commit-tree",tree,"-p","HEAD"],
stdin=PIPE,stdout=PIPE).communicate("cv")[0].rstrip()
<<<<<<<<<<<<<<<<<
Here files contains the set of files to be recorded in the current snapshot,
structured as (directory,set of files in directory).)
Many thanks for any insight,
--
cheers, dave tweed__________________________
david "DOT" tweed "AT" gmail "DOT" com
Rm 124, School of Systems Engineering, University of Reading.
Details are all that matters; God dwells there, and you never get to
see Him if you don't struggle to get them right. -- Stephen Jay Gould
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: clarification on git-update-index --remove
2007-01-04 19:29 clarification on git-update-index --remove David Tweed
@ 2007-01-04 20:27 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-01-04 20:27 UTC (permalink / raw)
To: David Tweed; +Cc: git
"David Tweed" <david.tweed@gmail.com> writes:
> --remove::
> If a specified file is in the index but is missing then it's
> removed.
> Default behavior is to ignore removed file.
If necessary, better rewording to remove confusion is very much
appreciated.
"update-index <path>..." without options (that is "Default
behaviour") updates the index using the contents of the named
<path> found on the filesystem. It does _not_ add new paths to
the index, nor remove paths (that exists in the index) from the
index.
Giving --add allows new paths to be added to the index if named
paths are found on the filesystem. Giving --remove allows
existing paths to be removed from the index if named paths are
not found on the filesystem.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-04 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-04 19:29 clarification on git-update-index --remove David Tweed
2007-01-04 20:27 ` Junio C Hamano
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).