-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
pygit2.GitError: no error #1315
Comments
|
Like what does exception saying "No error" mean? Shouldn't Is this supposed to work or not? |
Can you try again with latest version of |
python: 3.11.11 (main, Dec 06 2024, 17:06:18) [GCC] |
I am a bit confused on what the actual issue is. Are you trying to set up a script to achieve a certain goal? |
I am trying to fabricate a repository. There are a number of ways to go about that, and the documentation is not clear enough to be able to pick one sure way that would certainly work. One of the ways that can be picked results in pygit2 throwing very unhelpful "No error" exception. Either there is a bug that something that should have actually worked does not, or there is a bug that something that failed fails to propagate the failure reason somewhere. In any case this sounds like a situation that is broken either way, it's just not clear which way. |
Can you show the equivalent in bash commands? mkdir new-repo
cd new-repo
git init Something like that... |
git init new-repo |
Note this is not completely equivalent because the API for updating branches does not match commandline. The problem seems to be that updating unborn branch is broken. |
Can we first settle on what you want to accomplish? Because the commands you gave don't run successfully. I am assuming this is the full logic? Corrected for some commands and included some more. You left it as an exercise for the reader? 😂 git init new-repo
cd new-repo
echo 6.6 > version
# The file is not yet tracked by git. You can't just `git commit ..`.
git add version # Or `git add .`; makes no difference here.
# Need quotes around the message.
git commit -m "added version"
# You remain on main branch in your example.
git switch -c longterm
echo 6.10 > version
# Now you can commit the file without even staging it.
# Still need quotes around the message though.
git commit -m "added version" version
# The rest makes no difference... so let's ignore it. |
right, you need to add the version file |
and no, this does not involve switch. |
The difference between the commandline and the libgit implementation is that the commandline advances the master branch multiple times while the libgit2 implementation probably does not, or would not if it worked. |
Note that the stacking of the branches may not be the same because the 'data' hash does not list them from oldest to newest but whatever. |
So you want to commit the changes to the |
I want to create three different branches, each with different content in the version file. It's difficult and unrealistic to make them all separate history roots so the different commits to which the branches point have to be in the same history. |
But you can't commit to a branch, unless you're "on it". At least not without jumping through hoops. So how do you do that without switching to it? And if for some reason you absolutely want to have a new branch start with its own history, there's this option git switch --orphan <new branch name> |
I can create a branch from the current commit, both on commandline and in libgit, no need to switch to it, or commit to it. |
In fact I have no idea how I would 'commit to a branch' in libgit. |
I'm even more lost now because I see contradicting statements. |
So one way that works is master = repo.create_commit('HEAD', sig, sig, 'master commit', tree.write(), []) which is quite awkward, and it's non-obvious why this would work, and the other way throws an exception. Also it creates the branches backwards, stable ahead of master. Which does not really matter in this case but is another awkward result of randomly trying things until something sticks because there is no clear description of what should work, nor a clear description of why things that don't work don't. |
git init new-repo |
|
Traceback (most recent call last):
File "/home/hramrach/kbuild/python/tests/test_branch_graph.py", line 32, in setUp
self.repo.lookup_branch(branch).set_target(commit)
_pygit2.GitError: no error
???
The text was updated successfully, but these errors were encountered: