From: Junio C Hamano <junkio@cox.net>
To: Matthias Urlichs <smurf@smurf.noris.de>
Cc: git@vger.kernel.org
Subject: Should "git-read-tree -m -u" delete files?
Date: Fri, 24 Jun 2005 15:08:44 -0700 [thread overview]
Message-ID: <7v1x6rbe6r.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <pan.2005.06.24.13.16.10.406827@smurf.noris.de> (Matthias Urlichs's message of "Fri, 24 Jun 2005 15:16:13 +0200")
>>>>> "MU" == Matthias Urlichs <smurf@smurf.noris.de> writes:
MU> The only problem I have with it is that "git-read-tree -m -u"
MU> doesn't delete files yet. To repeat my question from last week:
>>> Would it be safe to add all files for which
>>> read_tree.c:merge_cache:fn() returns zero to a "delete me" list?
MU> (files on which which then actually get deleted, of course, if g-r-t
MU> doesn't find any problems.)
As the guilty party for the "read-tree two-way semantics table"
you quoted in your "question from last week" message, I should
have replied sooner but could not. Sorry about that [*1*].
Anyway, here are my answers.
(1) No, merge_function[] returning zero just means "I did not
cause anything to change the number of already processed
entries". When it wants to delete an entry, it explicitly
marks the entry to be deleted by calling deleted_entry(),
and the deletion is processed at the very end by
check_updates() function. Note that we do _not_ return
zero in this case.
(2) The part you quoted in your "last week" message is case 10;
the current code does delete the path with -u [*2*].
(3) There could be cases where twoway_merge() does not delete a
clean path that _should_ be removed. If that is the case
then you have spotted a bug --- I would appreciate it if
you can show a reproduction recipe. I have looked at the
function briefly again while writing this reply and did not
find suspicious code that would just return 0 without
calling deleted_entry(), though.
(4) Using --emu23 (followed by git-merge-cache, of course),
instead of doing "git-read-tree -m -u H M", should remove
deleted paths as well.
[Footnote]
*1* I was on a crazy travel schedule, going just for 3 days last
week and then for another 2 days this week to Japan from US west
coast, two 10-hour roundtrip flights X-<. Now I am back and
hopefully fully functional ;-).
*2* The part you quoted in your previous message was this. I am
re-quoting from the original to give it a bit more context:
Two Tree Merge
~~~~~~~~~~~~~~
...
In this case, the "git-read-tree -m $H $M" command makes sure
that no local change is lost as the result of this "merge".
Here are the "carry forward" rules:
I (index) H M Result
-------------------------------------------------------
...
clean I==H I==M
------------------
...
10 yes yes N/A exists nothing remove path from cache
This case is covered by this test in t1002:
test_expect_success \
'10 - path removed.' \
'rm -f .git/index &&
echo rezrov >rezrov &&
git-update-cache --add rezrov &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >10.out &&
cmp M.out 10.out &&
sha1sum -c M.sha1'
Where paths involved are:
path treeH treeM
-----------------------------------------------------
bozbar exists modified from treeH
frotz does not exist added in treeM
nitfol exists same as in treeH
rezrov exists deleted in treeM
and after this test runs, you can see that the path "rezrov"
gets removed from your work tree. Insert "exit" just before the
next test, run "cd t && sh t1002-*.sh -i -v", and inspect what
is in the "t/trash" directory.
next prev parent reply other threads:[~2005-06-24 22:12 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 22:24 Updated git HOWTO for kernel hackers Jeff Garzik
2005-06-22 22:40 ` Dave Jones
2005-06-22 22:47 ` Jeff Garzik
2005-06-22 22:52 ` Dave Jones
2005-06-23 0:14 ` Jeff Garzik
2005-06-25 3:33 ` Jeff Garzik
2005-06-25 17:29 ` Dave Jones
2005-06-22 23:09 ` Greg KH
2005-06-22 23:25 ` Linus Torvalds
2005-06-23 0:05 ` Jeff Garzik
2005-06-23 0:29 ` Linus Torvalds
2005-06-23 1:47 ` Jeff Garzik
2005-06-23 1:56 ` Linus Torvalds
2005-06-23 2:16 ` Jeff Garzik
2005-06-23 2:39 ` Linus Torvalds
2005-06-23 3:06 ` Jeff Garzik
2005-06-23 3:24 ` Linus Torvalds
2005-06-23 5:16 ` Jeff Garzik
2005-06-23 5:58 ` Linus Torvalds
2005-06-23 6:20 ` Greg KH
2005-06-23 6:51 ` Linus Torvalds
2005-06-23 7:11 ` Greg KH
2005-06-23 7:03 ` Jeff Garzik
2005-06-23 7:38 ` Petr Baudis
2005-06-23 8:18 ` Martin Langhoff
2005-06-23 8:30 ` Vojtech Pavlik
2005-06-23 14:31 ` Horst von Brand
2005-06-22 23:16 ` Linus Torvalds
2005-06-23 0:15 ` Jeff Garzik
2005-06-23 1:53 ` Linus Torvalds
2005-06-23 7:06 ` Jeff Garzik
2005-06-23 15:29 ` Linus Torvalds
2005-06-23 0:33 ` Linus Torvalds
2005-06-23 2:04 ` Jeff Garzik
2005-06-23 2:28 ` Linus Torvalds
2005-06-23 3:52 ` Adam Kropelin
2005-06-23 4:54 ` Linus Torvalds
2005-06-23 5:35 ` Jeff Garzik
2005-06-23 6:37 ` Linus Torvalds
2005-06-23 6:07 ` Miles Bader
2005-06-23 7:15 ` Jeff Garzik
2005-06-23 16:06 ` Linus Torvalds
2005-06-23 8:01 ` Anton Altaparmakov
2005-06-23 4:23 ` Daniel Barkalow
2005-06-23 12:25 ` Dave Airlie
2005-06-23 23:56 ` Mercurial vs " Matt Mackall
2005-06-24 6:41 ` Petr Baudis
2005-06-24 12:38 ` Christopher Li
2005-06-28 15:00 ` Petr Baudis
2005-06-28 15:10 ` Andrew Thompson
2005-06-28 15:35 ` Petr Baudis
2005-06-28 21:54 ` Horst von Brand
2005-06-28 18:47 ` Christopher Li
2005-06-29 0:12 ` Kyle Moffett
2005-06-28 18:01 ` Matt Mackall
2005-06-28 20:27 ` Kyle Moffett
2005-06-28 20:45 ` Sean
2005-06-28 22:14 ` Matt Mackall
2005-06-28 22:23 ` Sean
2005-06-28 22:47 ` Kyle Moffett
2005-06-28 22:49 ` Matt Mackall
2005-06-28 22:59 ` Sean
2005-06-28 23:25 ` Kyle Moffett
2005-06-28 23:37 ` Sean
2005-06-29 0:08 ` Kyle Moffett
2005-06-29 0:25 ` Sean
2005-06-29 3:53 ` Kyle Moffett
2005-06-29 10:27 ` Vojtech Pavlik
2005-06-28 23:29 ` Matt Mackall
2005-06-29 6:32 ` Thomas Arendsen Hein
2005-06-24 13:06 ` Andrea Arcangeli
2005-06-24 13:39 ` Theodore Ts'o
2005-06-24 13:46 ` Paolo Ciarrocchi
2005-06-24 12:19 ` Christopher Li
2005-06-24 13:57 ` Kevin Smith
2005-06-24 18:03 ` Matt Mackall
2005-06-28 15:07 ` Petr Baudis
2005-06-28 15:15 ` Sven Verdoolaege
2005-06-28 15:34 ` Petr Baudis
2005-06-28 16:50 ` Cygwin and Native MS Windows (was: Mercurial vs Updated git HOWTO for kernel hackers) Kevin Smith
2005-06-28 16:51 ` Cogito vs. Git " Kevin Smith
2005-06-28 20:54 ` Petr Baudis
2005-06-24 13:16 ` Mercurial vs Updated git HOWTO for kernel hackers Matthias Urlichs
2005-06-24 19:00 ` Linus Torvalds
2005-06-24 19:25 ` John W. Linville
2005-06-24 22:38 ` Jeff Garzik
2005-06-24 21:11 ` Daniel Barkalow
2005-06-24 22:08 ` Junio C Hamano [this message]
2005-06-24 22:45 ` Joel Becker
2005-06-24 23:08 ` Kyle Moffett
2005-06-27 18:31 ` Pavel Machek
2005-06-27 19:05 ` Kyle Moffett
2005-06-27 19:40 ` Matt Mackall
2005-06-27 19:51 ` Benjamin LaHaise
2005-06-27 20:51 ` Matt Mackall
2005-06-27 21:53 ` Ed Tomlinson
2005-07-08 15:18 ` Amin Azez
2005-07-11 8:56 ` Amin Azez
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v1x6rbe6r.fsf_-_@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=smurf@smurf.noris.de \
/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.
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).