From: Junio C Hamano <junkio@cox.net>
To: Jeff Garzik <jeff@garzik.org>
Cc: git@vger.kernel.org, Ryan Anderson <ryan@michonline.com>
Subject: [PATCH] checkout -f: do not leave untracked working tree files.
Date: Tue, 20 Jun 2006 02:50:08 -0700 [thread overview]
Message-ID: <7vfyi0b1gv.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vr71kb257.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Tue, 20 Jun 2006 02:35:32 -0700")
Earlier we did not consider untracked working tree files
"precious", but we have always considered them fair game to
clobber. These days, branch switching by read-tree is more
careful and tries to protect untracked working tree files. This
caused the following workflow to stop working:
git checkout one-branch-with-file-F
git checkout -f another-without-file-F
git pull . one-branch-with-file-F
Because the second checkout leaves F from the previous state as
untracked file in the working tree, the merge would fail, trying
to protect F from being clobbered.
This changes "git checkout -f" to remove working tree files that
are known to git in the switched-from state but do not exist in
the switched-to state, borrowing the same logic from "reset --hard".
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* I am going to bed without trying this out since it is very
late tonight. Might be in "pu" or "next" tomorrow depending
on my mood. If this works out for Jeff, I can simply drop
the "core.oktoclobber = ask" patch from my topics -- although
I kind of liked that one ;-).
git-checkout.sh | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/git-checkout.sh b/git-checkout.sh
index 564117f..77c2593 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -137,8 +137,7 @@ # what we already had
if [ "$force" ]
then
- git-read-tree --reset $new &&
- git-checkout-index -q -f -u -a
+ git-read-tree --reset -u $new
else
git-update-index --refresh >/dev/null
merge_error=$(git-read-tree -m -u $old $new 2>&1) || (
--
1.4.0.g59268
next prev parent reply other threads:[~2006-06-20 9:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-18 13:40 git 1.4.0 usability problem Jeff Garzik
2006-06-18 16:43 ` Ryan Anderson
2006-06-18 22:27 ` Ryan Anderson
2006-06-18 19:30 ` Junio C Hamano
2006-06-18 22:25 ` Junio C Hamano
2006-06-18 23:01 ` Jeff Garzik
2006-06-19 3:11 ` Junio C Hamano
2006-06-20 8:36 ` Jeff Garzik
2006-06-20 9:16 ` Ryan Anderson
2006-06-20 9:35 ` Junio C Hamano
2006-06-20 9:50 ` Junio C Hamano [this message]
2006-06-20 11:01 ` [PATCH] checkout -f: do not leave untracked working tree files Santi Béjar
2006-06-20 11:18 ` Junio C Hamano
2006-06-20 11:27 ` Alexander Litvinov
2006-06-20 11:51 ` Junio C Hamano
2006-06-20 12:08 ` Alexander Litvinov
2006-06-20 14:07 ` Carl Worth
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=7vfyi0b1gv.fsf_-_@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=jeff@garzik.org \
--cc=ryan@michonline.com \
/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).