summaryrefslogtreecommitdiff
path: root/git-filter-branch.sh
AgeCommit message (Collapse)Author
2007-06-23filter-branch: add example to move everything into a subdirectoryJohannes Schindelin
This is based on Jeff King's example in 20070621130137.GB4487@coredump.intra.peff.net Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09filter-branch: subdirectory filter needs --full-historyJohannes Sixt
When two branches are merged that modify a subdirectory (possibly in different intermediate steps) such that both end up identical, then rev-list chooses only one branch. But when we filter history, we want to keep both branches. Therefore, we must use --full-history. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09filter-branch: Simplify parent computation.Johannes Sixt
We can use git rev-list --parents when we list the commits to rewrite. It is not necessary to run git rev-list --parents for each commit in the loop. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09Teach filter-branch about subdirectory filteringJohannes Schindelin
With git-filter-branch --subdirectory-filter <subdirectory> you can get at the history, as seen by a certain subdirectory. The history of the rewritten branch will only contain commits that touched that subdirectory, and the subdirectory will be rewritten to be the new project root. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06filter-branch: also don't fail in map() if a commit cannot be mappedJohannes Sixt
The map() function can be used by filters to map a commit id to its rewritten id. Such a mapping may not exist, in which case the identity mapping is used (the commit is returned unchanged). In the rewrite loop, this mapping is also needed, but was done explicitly in the same way. Use the map() function instead. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06filter-branch: Use rev-list arguments to specify revision ranges.Johannes Sixt
A subset of commits in a branch used to be specified by options (-k, -r) as well as the branch tip itself (-s). It is more natural (for git users) to specify revision ranges like 'master..next' instead. This makes it so. If no range is specified it defaults to 'HEAD'. As a consequence, the new name of the filtered branch must be the first non-option argument. All remaining arguments are passed to 'git rev-list' unmodified. The tip of the branch that gets filtered is implied: It is the first commit that git rev-list would print for the specified range. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06filter-branch: fix behaviour of '-k'Johannes Schindelin
The option '-k' says that the given commit and _all_ of its ancestors are kept as-is. However, if a to-be-rewritten commit branched from an ancestor of an ancestor of a commit given with '-k', filter-branch would fail. Example: A - B \ C If filter-branch was called with '-k B -s C', it would actually keep B (and A as its parent), but would rewrite C, and its parent. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06filter-branch: use $(($i+1)) instead of $((i+1))Johannes Schindelin
The expression $((i+1)) is not portable at all: even some bash versions do not grok it. So do not use it. Noticed by Jonas Fonseca. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06chmod +x git-filter-branch.shMatthias Lederhofer
Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06filter-branch: prevent filters from reading from stdinMatthias Lederhofer
stdin is the list of commits when the env, tree and index filter are executed. The filters are not supposed to read anything from stdin so the best is to give them /dev/null for reading. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-03Add git-filter-branchJohannes Schindelin
This script is derived from Pasky's cg-admin-rewritehist. In fact, it _is_ the same script, minimally adapted to work without cogito. It _should_ be able to perform the same tasks, even if only relying on core-git programs. All the work is Pasky's, just the adaption is mine. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Hopefully-signed-off-by: Petr "cogito master" Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>