<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-filter-branch.sh, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-04-22T18:26:55Z</updated>
<entry>
<title>Merge branch 'jk/filter-branch-come-back-to-original' into maint</title>
<updated>2013-04-22T18:26:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-22T18:26:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13e11087fed94279a5364dd87230586fb87baf8b'/>
<id>urn:sha1:13e11087fed94279a5364dd87230586fb87baf8b</id>
<content type='text'>
* jk/filter-branch-come-back-to-original:
  filter-branch: return to original dir after filtering
</content>
</entry>
<entry>
<title>filter-branch: return to original dir after filtering</title>
<updated>2013-04-02T20:34:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-04-02T14:22:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=97276019bb20829c97528b53dc453a37177c35bb'/>
<id>urn:sha1:97276019bb20829c97528b53dc453a37177c35bb</id>
<content type='text'>
The first thing filter-branch does is to create a temporary
directory, either ".git-rewrite" in the current directory
(which may be the working tree or the repository if bare),
or in a directory specified by "-d". We then chdir to
$tempdir/t as our temporary working directory in which to run
tree filters.

After finishing the filter, we then attempt to go back to
the original directory with "cd ../..". This works in the
.git-rewrite case, but if "-d" is used, we end up in a
random directory. The only thing we do after this chdir is
to run git-read-tree, but that means that:

  1. The working directory is not updated to reflect the
     filtered history.

  2. We dump random files into "$tempdir/.." (e.g., if you
     use "-d /tmp/foo", we dump junk into /tmp).

Fix it by recording the full path to the original directory
and returning there explicitly.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>filter-branch: use git-sh-setup's ident parsing functions</title>
<updated>2012-10-18T22:43:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-10-18T10:33:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3c730fab2cae1bb52d34620af170a628b3b8c537'/>
<id>urn:sha1:3c730fab2cae1bb52d34620af170a628b3b8c537</id>
<content type='text'>
This saves us some code, but it also reduces the number of
processes we start for each filtered commit. Since we can
parse both author and committer in the same sed invocation,
we save one process. And since the new interface avoids tr,
we save 4 processes.

It also avoids using "tr", which has had some odd
portability problems reported with from Solaris's xpg6
version.

We also tweak one of the tests in t7003 to double-check that
we are properly exporting the variables (because test-lib.sh
exports GIT_AUTHOR_NAME, it will be automatically exported
in subprograms. We override this to make sure that
filter-branch handles it properly itself).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/maint-filter-branch-epoch-date'</title>
<updated>2012-07-22T19:55:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-07-22T19:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a0231b395cb9720365b7066312eeaa86e37ed31'/>
<id>urn:sha1:9a0231b395cb9720365b7066312eeaa86e37ed31</id>
<content type='text'>
In 1.7.9 era, we taught "git rebase" about the raw timestamp format
but we did not teach the same trick to "filter-branch", which rolled
a similar logic on its own.  Because of this, "filter-branch" failed
to rewrite commits with ancient timestamps.

* jc/maint-filter-branch-epoch-date:
  t7003: add test to filter a branch with a commit at epoch
  date.c: Fix off by one error in object-header date parsing
  filter-branch: do not forget the '@' prefix to force git-timestamp
</content>
</entry>
<entry>
<title>filter-branch: do not forget the '@' prefix to force git-timestamp</title>
<updated>2012-07-10T03:42:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-07-09T23:53:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cb102b083252b575b18afa8d4b4a4b1bc1ffdf9e'/>
<id>urn:sha1:cb102b083252b575b18afa8d4b4a4b1bc1ffdf9e</id>
<content type='text'>
For some reason, this script reinvents, instead of refactoring the
existing one in git-sh-setup, the logic to grab ident information
from an existing commit; it was missed when the corresponding logic
in git-sh-setup was updated with 2c733fb (parse_date(): '@' prefix
forces git-timestamp, 2012-02-02).

Teach the script that it is OK to have a way ancient timestamp in
the commits that are being filtered.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/filter-branch-require-clean-work-tree'</title>
<updated>2011-10-05T19:35:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-05T19:35:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c140016508fe7329d5aa962b473d8e84af108b1'/>
<id>urn:sha1:9c140016508fe7329d5aa962b473d8e84af108b1</id>
<content type='text'>
* jk/filter-branch-require-clean-work-tree:
  filter-branch: use require_clean_work_tree
</content>
</entry>
<entry>
<title>filter-branch: use require_clean_work_tree</title>
<updated>2011-09-15T23:58:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-09-01T21:53:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5347a50fec066845e5dfa34a53cbec1ea347641d'/>
<id>urn:sha1:5347a50fec066845e5dfa34a53cbec1ea347641d</id>
<content type='text'>
Filter-branch already requires that we have a clean work
tree before starting. However, it failed to refresh the
index before checking, which means it could be wrong in the
case of stat-dirtiness.

Instead of simply adding a call to refresh the index, let's
switch to using the require_clean_work_tree function
provided by git-sh-setup. It does exactly what we want, and
with fewer lines of code and more specific output messages.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/sh-style'</title>
<updated>2011-08-18T00:35:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-08-18T00:35:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=146120588046e97e52367cad658b42accffa098e'/>
<id>urn:sha1:146120588046e97e52367cad658b42accffa098e</id>
<content type='text'>
* js/sh-style:
  filter-branch.sh: de-dent usage string
  misc-sh: fix up whitespace in some other .sh files.
</content>
</entry>
<entry>
<title>filter-branch: Export variable `workdir' for --commit-filter</title>
<updated>2011-08-08T19:09:38Z</updated>
<author>
<name>Michael Witten</name>
<email>mfwitten@gmail.com</email>
</author>
<published>2011-08-07T02:44:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0906f6e14e6e9df0c4ea4edb08ebe9f5d16c2391'/>
<id>urn:sha1:0906f6e14e6e9df0c4ea4edb08ebe9f5d16c2391</id>
<content type='text'>
According to `git help filter-branch':

       --commit-filter &lt;command&gt;
           ...
           You can use the _map_ convenience function in this filter,
           and other convenience functions, too...
           ...

However, it turns out that `map' hasn't been usable because it depends
on the variable `workdir', which is not propogated to the environment
of the shell that runs the commit-filter &lt;command&gt; because the
shell is created via a simple-command rather than a compound-command
subshell:

 @SHELL_PATH@ -c "$filter_commit" "git commit-tree" \
                 $(git write-tree) $parentstr &lt; ../message &gt; ../map/$commit ||
                         die "could not write rewritten commit"

One solution is simply to export `workdir'. However, it seems rather
heavy-handed to export `workdir' to the environments of all commands,
so instead this commit exports `workdir' for only the duration of the
shell command in question:

 workdir=$workdir @SHELL_PATH@ -c "$filter_commit" "git commit-tree" \
                 $(git write-tree) $parentstr &lt; ../message &gt; ../map/$commit ||
                         die "could not write rewritten commit"

Signed-off-by: Michael Witten &lt;mfwitten@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>filter-branch.sh: de-dent usage string</title>
<updated>2011-08-05T22:06:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-08-05T22:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9dcca58db42e85e056c6523429204f367a671a0e'/>
<id>urn:sha1:9dcca58db42e85e056c6523429204f367a671a0e</id>
<content type='text'>
"Usage: git filter-branch " that is prefixed to the first line is 25
columns long, so the "[--index-filter ..." on the second line would not
align with "[--env-filter ..." on the first line to begin with. If the
second and subsequent lines do not aim to align with anything on the
first line, it is just fine to indent them with a single HT.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
