Re: [PATCH] Add git-filter-branch
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:43:14
Johannes Schindelin wrote:
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 <redacted> Hopefully-signed-off-by: Petr "cogito master" Baudis [off-list ref]
If you hadn't done that, I'd done it sooner or later. Thanks!
+ -r)
+ unchanged="$(get_parents "$OPTARG") $unchanged"
+ ;;
+ -k)
+ unchanged="$(git-rev-parse "$OPTARG"^{commit}) $unchanged"
+ ;;These two (-r and -k) together with...
+# seed with identity mappings for the parents where we start off +for commit in $unchanged; do + echo $commit > ../map/$commit +done
... this and ...
+ if [ -r "../map/$parent" ]; then + for reparent in $(cat "../map/$parent"); do + parentstr="$parentstr -p $reparent" + done + else + die "assertion failed: parent $parent for commit $commit not found in rewritten ones"
... this, means that any simple command like git filter-branch -k orgin/master origin/next new-next of your git.git clone will fail with the "assertion failed". (I haven't tried your script, yet, but cg-admin-rewritehist fails.) I propose that you just get rid of the "seed" stance and don't fail if a commit cannot be mapped - just use it unchanged (don't forget to adjust the map() function, too). Then you can get rid of -r and use -k to specify everything you want under "--not" in the rev-list. -- Hannes