1

I'm trying to test a change that is queued as a pull request. The pull request is on GitHub and located here. My script is:

export P11KIT_DIR=p11-kit-master

rm -rf "$P11KIT_DIR" 2>/dev/null

if ! git clone --depth=3 https://github.com/p11-glue/p11-kit.git "$P11KIT_DIR";
then
    echo "Failed to checkout p11-kit"
    exit 1
fi

cd "$P11KIT_DIR"

if ! git cherry-pick a0946a562a8e;
then
    echo "Failed to patch p11-kit"
    exit 1
fi

The script is dying with the error:

fatal: bad revision 'a0946a562a8e'
Failed to patch p11-kit

a0946a562a8e is clearly the revision number. I took it directly from GitHub. I'm guessing cherry-pick is the wrong command.

How do I add a0946a562a8e into master?

jww
  • 97,681
  • 90
  • 411
  • 885
  • That commit isn't in `p11-glue/p11-kit`, it's in `ueno/p11-kit`. Have a look at e.g. https://stackoverflow.com/q/13788945/3001761. – jonrsharpe Sep 18 '19 at 14:41

1 Answers1

5
  • You’re looking for the commit in the wrong repository

  • --depth implies --single-branch, so if it were the right repository you still wouldn’t be getting the right branch

GitHub provides refs for pull requests, though, so you can do this, replacing the cherry-pick step:

if ! git fetch origin pull/252/head;
then
    echo "Failed to fetch pull request"
    exit 1
fi

if ! git merge FETCH_HEAD;
then
    echo "Failed to patch p11-kit"
    exit 1
fi
Ry-
  • 218,210
  • 55
  • 464
  • 476