This is somewhat (extremely!) hairy but seems to work:
#!/bin/bash set -eux tarball=$1
#tmpdir=$(mktemp -d) #cleanup () { rm -rf $tmpdir; } #trap cleanup EXIT tmpdir=../my-uupdate-work mkdir $tmpdir
mkdir $tmpdir/unpacked tar -C $tmpdir/unpacked -xf $tarball --strip-components=1
index_file=$(realpath .git/my-uupdate-index) rm -f $index_file GIT_INDEX_FILE=$index_file GIT_WORK_TREE=$tmpdir/unpacked git add -A tmp_tree=$(GIT_INDEX_FILE=$index_file git write-tree) git ls-tree ${tmp_tree} > $tmpdir/tree deb_sha=$(git ls-tree HEAD^{tree} | awk '{ if ($4 == "debian") { print $3; } }') echo -e "040000 tree $deb_sha\tdebian" >> $tmpdir/tree new_tree=$(cat $tmpdir/tree | git mktree) echo "Update upstream source from '$(basename $tarball)'" > $tmpdir/commit-msg commit=$(git commit-tree -p HEAD -F $tmpdir/commit-msg ${new_tree}) git merge $commit
(cobbled together from reading bits of what gdb import-orig does)
This is somewhat (extremely!) hairy but seems to work:
#!/bin/bash
set -eux
tarball=$1
#tmpdir=$(mktemp -d) ../my-uupdate- work
#cleanup () { rm -rf $tmpdir; }
#trap cleanup EXIT
tmpdir=
mkdir $tmpdir
mkdir $tmpdir/unpacked components= 1
tar -C $tmpdir/unpacked -xf $tarball --strip-
index_file= $(realpath .git/my- uupdate- index) FILE=$index_ file GIT_WORK_ TREE=$tmpdir/ unpacked git add -A $(GIT_INDEX_ FILE=$index_ file git write-tree)
rm -f $index_file
GIT_INDEX_
tmp_tree=
git ls-tree ${tmp_tree} > $tmpdir/tree
deb_sha=$(git ls-tree HEAD^{tree} | awk '{ if ($4 == "debian") { print $3; } }')
echo -e "040000 tree $deb_sha\tdebian" >> $tmpdir/tree
new_tree=$(cat $tmpdir/tree | git mktree)
echo "Update upstream source from '$(basename $tarball)'" > $tmpdir/commit-msg
commit=$(git commit-tree -p HEAD -F $tmpdir/commit-msg ${new_tree})
git merge $commit
(cobbled together from reading bits of what gdb import-orig does)