Comments (3)
Ah! That scenario slipped through the cracks, because if you create a repo with "git init" it typically sets up a fetch "refspec" for you:
https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
I'll implement a fallback default refspec to use if there's not one in the config file.
from isomorphic-git.
aaaahhh........ OK so, interesting thing is, git does something completely different than what you might expect if you actually use that config file as you have it written:
> mkdir issue-84
> cd issue-84
> git init
> cat <<EOF > .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://gitlab.com/TomasHubelbauer/bloggo.git
EOF
> git fetch origin
remote: Counting objects: 1222, done.
remote: Compressing objects: 100% (538/538), done.
Receiving objects: 87% (1064/1222) d 1169 (delta 654)
Receiving objects: 100% (1222/1222), 256.13 KiB | 2.81 MiB/s, done.
Resolving deltas: 100% (704/704), done.
From https://gitlab.com/TomasHubelbauer/bloggo
* branch HEAD -> FETCH_HEAD
It didn't fetch the branches in the remote and store them in refs/remotes/origin
at all!
> ls .git/refs
heads/ tags/
Instead it fetch the remote HEAD and wrote something in .git/FETCH_HEAD
in... some new format that I'll have to add support for I guess.
> cat .git/FETCH_HEAD
c610ce1a1e0e383a757af94bb95baeb080d21412 https://gitlab.com/TomasHubelbauer/bloggo
Now if we modify the config file to include the fetch refspec and do the exact same fetch:
> echo "fetch = +refs/heads/*:refs/remotes/origin/*" >> .git/config
> git fetch origin
From https://gitlab.com/TomasHubelbauer/bloggo
* [new branch] master -> origin/master
Now we see it saved the fetched branches where we'd normally expect them:
> ls .git/refs
heads/ remotes/ tags/
> ls .git/refs/remotes
origin/
> ls .git/refs/remotes/origin/
master
Interestingly, it updated FETCH_HEAD too:
> cat .git/FETCH_HEAD
c610ce1a1e0e383a757af94bb95baeb080d21412 not-for-merge branch 'master' of https://gitlab.com/TomasHubelbauer/bloggo
I don't want to make isomorphic-git differ from canonical git's behavior. But I also haven't implemented the weirdness that is FETCH_HEAD. So for now... I think I'll just throw a warning if the config file is missing the "fetch" field for a remote and suggest using the default fetch = +refs/heads/*:refs/remotes/origin/*
from isomorphic-git.
🎉 This issue has been resolved in version 0.9.4 🎉
The release is available on:
Your semantic-release bot 📦🚀
from isomorphic-git.
Related Issues (20)
- Properly propagate error encountered when reading response from git-upload-pack POST request HOT 4
- No shallow directory error HOT 3
- isPromiseFs fails on Deno HOT 9
- Improve `normalizePath` performance HOT 6
- pushing a tag to a target branch fail HOT 1
- Empty response from git server when using code bundler HOT 33
- Pushing returning 401 Error: No Anonymous Write Access HOT 6
- Tests are failing on Android HOT 15
- Cloning empty repository fails if git server uses git >= 2.41.0 HOT 5
- Getting a 404 with azure devops HOT 1
- not respecting server capabilities ( report-status ) HOT 1
- How can I abort a push operation on Node? AbortController seems to be not supported. HOT 2
- Codespell workflow needs approval
- Disable failing test that require credentials on Azure DevOps HOT 14
- Race condition makes it possible for a ref to be resolved to an empty string while it's in the middle of being updated HOT 16
- Invalid refs should throw HOT 11
- Isomorphic git functionality is broken on any browser
- Error Running Linter on main locally HOT 4
- Github Clone Broken on Latest Version HOT 6
- Pushing an annotated tag has slightly different behavior between isomorphic-git and Git HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isomorphic-git.