Created
December 21, 2016 17:48
-
-
Save milouse/f305202c66b9df7e473037cd1f1cfa6b to your computer and use it in GitHub Desktop.
Shell script to create (and update) a git mirror of a fossil repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script should be called from a bare git repository | |
# $1 should contain the path to the fossil file to export | |
[ -z "$1" ] && exit 1 | |
[ -f tmp_export_file ] && rm tmp_export_file | |
fossil export --git "$1" > tmp_export_file | |
sed -i "s/fossil_user <fossil_user>/Étienne Deparis <[email protected]>/g" tmp_export_file | |
cat tmp_export_file | git fast-import | |
if [ -n "$2" -a "$2" = 'github' ]; then | |
GITHUB_TARGET=$(git remote -v | grep 'github.com:milouse' | head -n1 | cut -f1) | |
git push $GITHUB_TARGET trunk | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment