diff --git a/generate-git-repo-from-patches.sh b/generate-git-repo-from-patches.sh index 8477e30..8646c4e 100755 --- a/generate-git-repo-from-patches.sh +++ b/generate-git-repo-from-patches.sh @@ -51,12 +51,12 @@ test -f _patch_order || die "Cannot find _patch_order file." last_ancestor_commit=`cat _git_upstream_commit` +f=`pwd` cd $1 git name-rev $last_ancestor_commit test $? -eq 0 || die "Could not find $last_ancestor_commit in the repository $1. Did you run 'git fetch'?" -f=`cd .. && pwd` # Create a branch for the checkout if using stgit; use the distro name in # the name of this branch. @@ -69,8 +69,8 @@ fi git checkout $branch $last_ancestor_commit echo "Applying patches..." -for p in `cat ../_patch_order` ; do - git am ../$p +for p in `cat $f/_patch_order` ; do + git am $f/$p test $? -eq 0 || die "Could not apply patch '$p'." done diff --git a/generate-patches-from-git-repo.sh b/generate-patches-from-git-repo.sh index c9bc3a9..7947c8a 100755 --- a/generate-patches-from-git-repo.sh +++ b/generate-patches-from-git-repo.sh @@ -50,6 +50,7 @@ for f in `cat _patch_order` ; do git rm -f $f done +orig_dir=`pwd` cd $1 # If patches were uncommitted when the patches were applied, @@ -82,8 +83,8 @@ for c in `git rev-list --reverse ${common_ancestor}..HEAD` ; do # before, even if nothing has changed. This is bad, so we replace # the commit hash by something constant (the string # "FEDORA_PATCHES"). - git format-patch --no-signature --no-stat --keep-subject -1 --stdout $c | sed -e '1 s/^From [0-9a-f]\+ \(.*\)/From FEDORA_PATCHES \1/' -e '/^index [0-9a-f]\+\.\.[0-9a-f]\+.*$/d' > ../$fname - (cd .. && git add $fname) + git format-patch --no-signature --no-stat --keep-subject -1 --stdout $c | sed -e '1 s/^From [0-9a-f]\+ \(.*\)/From FEDORA_PATCHES \1/' -e '/^index [0-9a-f]\+\.\.[0-9a-f]\+.*$/d' > $orig_dir/$fname + (cd $orig_dir && git add $fname) cat >> $temp_PATCH_file <