Git development
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jean-François Veillette" <jean_francois_veillette@yahoo.ca>,
	Git <git@vger.kernel.org>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] filter-branch: Fix renaming a directory in the   tree-filter
Date: Mon, 31 Mar 2008 10:47:31 +0200	[thread overview]
Message-ID: <47F0A523.80906@viscovery.net> (raw)
In-Reply-To: <7v3aq7mgly.fsf@gitster.siamese.dyndns.org>

Junio C Hamano schrieb:
> For example, if you make it the invariant that $T contains the tree that
> matches the contents of the "$tempdir/t" work tree left in the previous
> round of filter-tree (and obviously you would want to do this only
> filter_tree is in effect), the "checkout-index + clean" would become a
> proper "branch switching".
> 
> This is obviously untested, and you would need to prime $T with an empty
> tree before entering the loop (but you could cheat by initializing T with
> an empty string), but it might make the code a bit more readable than the
> current mess.  I dunno.
> 
> 	if [ "$filter_tree" ]; then
> -		git checkout-index -f -u -a ||
> -			die "Could not checkout the index"
> -		# files that $commit removed are now still in the working tree;
> -		# remove them, else they would be added again
> -		git clean -d -q -f -x
> +		git read-tree -m -u $T $commit
> 		eval "$filter_tree" < /dev/null ||
> 			die "tree filter failed: $filter_tree"
> 
> -		(
> -			git diff-index -r --name-only $commit
> -			git ls-files --others
> -		) |
> -		git update-index --add --replace --remove --stdin
> +		git add -u && git add . && T=$(git write-tree)
> 	fi

Yes. But, ... uhm ..., I'm not that deep into these plumbings; I leave it
to Dscho to comment on this.

-- Hannes

  reply	other threads:[~2008-03-31  8:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-30 14:35 [bug] filter-branch skipping removed files Jean-François Veillette
2008-03-30 23:05 ` Jean-François Veillette
2008-03-31  7:14   ` [PATCH] filter-branch: Test renaming directories in a tree-filter Johannes Sixt
2008-03-31  7:14     ` [PATCH] filter-branch: Fix renaming a directory in the tree-filter Johannes Sixt
2008-03-31  8:03       ` Johannes Sixt
2008-03-31  8:40       ` Junio C Hamano
2008-03-31  8:47         ` Johannes Sixt [this message]
2008-03-31 12:15         ` Johannes Schindelin
2008-03-31 11:25       ` Jean-François Veillette

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=47F0A523.80906@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jean_francois_veillette@yahoo.ca \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox