Skip to content

Instantly share code, notes, and snippets.

@vi
Created April 8, 2014 11:00
Show Gist options
  • Select an option

  • Save vi/10109824 to your computer and use it in GitHub Desktop.

Select an option

Save vi/10109824 to your computer and use it in GitHub Desktop.
bup: Script to convert a result of pre-"bup-split-to-vfs-file" `bup split` into a FUSE-accessible "data" file.
#!/bin/bash
FROM="$1"
TO="$2"
if [[ -z "$FROM" || -z "$TO" ]]; then
echo "bupslitfixup - convert \"bup split\"-generated content into a form suitable for \"bup fuse.\""
echo "Note: \"bup-split-to-vfs-file\" patch makes \"bup split\" to save content in such form automatically."
echo "Usage: bupsplitfixup treeish_to_be_fixed branch_name_to_create"
echo "Example: bup split -n qqq < something.dat; bupsplitfixup qqq qqq_fixed"
echo "Note: Existing ref with branch_name_to_create is overwritten"
echo "This fixing up is a lightweight operation"
exit 1.
fi
if [[ ! -z "$BUP_DIR" ]]; then
export GIT_DIR=$BUP_DIR
fi
set -e
T=$(git log -n 1 --format='%T' "$FROM")
T2=$(printf "040000 tree $T\tdata.bup" | git mktree)
C=$(echo "Fixed up $FROM" | git commit-tree $T2)
git update-ref refs/heads/$TO $C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment