Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Incorrect fetch for baseRef #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rschristian
Copy link
Member

 /usr/bin/git fetch -n origin main
  From https://github.com/preactjs/preact
   * branch              main       -> FETCH_HEAD
   * [new branch]        main       -> origin/main
  successfully fetched base.ref
  checking out and building base commit
  /usr/bin/git reset --hard main
  fatal: ambiguous argument 'main': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'

As the repo is a shallow clone, fetches will only update the remote branch tracking the currently cloned branch, i.e., git fetch <another branch> won't have any effect (to my understanding). Providing a local branch to track the remote from will fix this, however.

Simple demonstration of the issue:

git clone git@github.com:preactjs/preact.git --depth=1
cd preact
git fetch -n origin disable-rendering-on-unmount # fetch will succeed, but not affect the repo
git reset --hard disable-rendering-on-unmount # will fail with the same error as shown above

git fetch -n origin disable-rendering-on-unmount:disable-rendering-on-unmount
git reset --hard disable-rendering-on-unmount # will succeed

Copy link

github-actions bot commented May 9, 2024

Size Change: 0 B

Total Size: 75.6 kB

ℹ️ View Unchanged
Filename Size
index.js 75.6 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant