From 0590c4193d6fc9abdb544258c4d603e14a08af91 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 25 Nov 2019 08:38:25 -0800 Subject: [PATCH] contrib: clarify a few points of usage Make it clearer that absolute paths should not be used for pathnames within a git repository. Also, fix the comment about how the insert-beginning script could be implemented as a one-liner; the example commented-out code should have used bytestrings. Signed-off-by: Elijah Newren --- contrib/filter-repo-demos/insert-beginning | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/filter-repo-demos/insert-beginning b/contrib/filter-repo-demos/insert-beginning index 7877c36..d137ce2 100755 --- a/contrib/filter-repo-demos/insert-beginning +++ b/contrib/filter-repo-demos/insert-beginning @@ -14,7 +14,7 @@ near the top of git-filter-repo. """ # Technically, this program could be replaced by a one-liner: -# git filter-repo --force --commit-callback "if not commit.parents: commit.file_changes.append(FileChange(b'M', $PATHNAME, $(git hash-object -w $FILENAME), 100644))" +# git filter-repo --force --commit-callback "if not commit.parents: commit.file_changes.append(FileChange(b'M', $RELATIVE_TO_PROJECT_ROOT_PATHNAME, b'$(git hash-object -w $FILENAME)', b'100644'))" # but let's do it as a full-fledged program that imports git_filter_repo # anyway... @@ -29,7 +29,7 @@ except ImportError: parser = argparse.ArgumentParser( description='Add a file to the root commit(s) of history') parser.add_argument('--file', type=os.fsencode, - help=("Path to file whose contents should be added to root commit(s)")) + help=("Relative-path to file whose contents should be added to root commit(s)")) args = parser.parse_args() if not args.file: raise SystemExit("Error: Need to specify the --file option")