archives2git - generate a Git history from a series of release tarballs
archives2git [options] [--] archives_and_directories
archives2git replaces the contents of a Git repository subdir with that of an archive file (or of another directory) and commits the changes.
The options are parsed by git-rev-parse(1) with the option --parseopt.
command to extract the files of the $arch in $TMPDIR
sh code to strip the filename extension from $file
work tree subdir (current dir by default)
sh code to rename the current $file of the root
sh code to decide whether not to remove the $file of the root
argument to pass to git-add
sh code printing the commit author date for the current $arch
sh code printing the commit author name for the current $arch
sh code printing the commit title (and an optional body start)
string appended to the title as a new paragraph
argument to pass to git-commit
line separated arguments to pass to git-filter
tag the commits with the default tagname
tag the commits with the name printed by the given sh code
sh code to eval after having commited and tagged
enable the verbose printing of what is done
do not delete the temporary extraction dirs
print a usage message and exit
print the manual and exit
view the manual in the pager and exit
print the version information and exit
The following shell variables are usable if appropriate in the shell code snippets passed as command line options: $arch, $archdir, $archname, $file, $date, $author, $title, $tagname.
The following shell functions are defined in the script and are usable in the shell code snippets: get_version(filename).
After parameter and command substitutions and arithmetic expansion, it gives the path of the config file to source. If unset the default configuration file is sourced instead.
This file is sourced by the script. An example file is distributed.
This repository configuration file is preferred over the global one if it exists.
Some possible options:
$ ARCHIVES2GIT_ENV=/dev/null \
archives2git $(ls ../oldproject-*.tgz | sort -V) \
# keep (only) the .gitignore file
--keep-filter 'test x.gitignore = x"$file"'
--keep-filter 'echo "$file" | grep -q -f $HOME/filepats'
# suppress the version info from the root directory in the archive
--rename 'echo "${file%-*}"'
# allow to add ignored files
--gitadd-arg -f
# use the archive modification time as the author date (with GNU date)
--date 'LC_ALL=C date -r "$arch"'
# do not include the path components in the commit title
--title 'echo "${arch##*/}"'
# interactively edit each commit message
--gitci-arg "--edit"
# keep only the files of the project in the root of the tree
--gitfilter $'--subdirectory-filter\noldproject'
# move the project's files out of their subdir (while keeping other files)
--gitfilter $'--tree-filter\nmv oldproject/.* .; mv oldproject/* .'
See also the example configuration file.
Trailing whitespaces in filenames are not supported.
archives2git was written by G.raud Meyer.
git-commit-tree(1), git_load_dirs(1), git-rev-parse(1)