All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Erik Werner <martinerikwerner@gmail.com>
To: git@vger.kernel.org
Subject: Bug in filter-branch -d option, new files are dumped into parent
Date: Tue, 02 Apr 2013 14:32:21 +0200	[thread overview]
Message-ID: <1364905941.19800.24.camel@mas> (raw)

Hi,
I think I have stumbled on a bug in the -d option of git filter-branch.

It seems like in the final stage of filter-branch, regardless of where
-d is set, it will make updates to the "working directory" as being the
parent of the -d directory, and the actual working directory is left as
it were before the filtering.

For example if using -d /tmp/git-rewrite, the new checkout files are
dumped into /tmp.

A simple test scenario:

###
mkdir test
cd test
git init

echo foo >foo
git add foo
git commit -m"foo"
echo bar >bar
git add bar
git commit -m"bar"

git checkout -b rewrite
git filter-branch -d /tmp/git-rewrite --tree-filter 'echo baz >baz' --
rewrite
# git status
# shows 'baz' as unstaged-deleted in the working directory
#
# ls /tmp/
# shows the 'baz' file created in the root, above git-rewrite
#
# git log --stat --oneline
# does show expected result though
#
# if you run it again you'll get an error because of the /tmp/baz file
git reset --hard master
git filter-branch -f -d /tmp/git-rewrite --tree-filter 'echo baz >baz'
-- rewrite
# Rewrite afac18542ac3d432b647866f5ac6918b81b3bb78 (2/2)
# Ref 'refs/heads/rewrite' was rewritten
# error: Untracked working tree file 'baz' would be overwritten by
merge.
#
# At this point, 'baz' is instead staged-deleted in the working
directory
###

-- 
Martin Erik Werner <martinerikwerner@gmail.com>

             reply	other threads:[~2013-04-02 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 12:32 Martin Erik Werner [this message]
2013-04-02 14:22 ` [PATCH] filter-branch: return to original dir after filtering Jeff King

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=1364905941.19800.24.camel@mas \
    --to=martinerikwerner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.