Staged area modified after cross branch checkout
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Commencez par exécuter le reproducer test_checkout fourni et examinez le comportement de repo.checkout et repo.index lors des deux changements de branche. Comparez l’index staged après le retour sur master avec l’état vide attendu, et vérifiez le résultat par rapport au comportement décrit de git checkout.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I created two branches with commits like this:
Then I call checkout to switch the branch from old_master to master. Somehow, the cached area is updated after checkout:
Here's the code toe reproduce
import pathlib
import pygit2
def test_checkout(tmp_path: pathlib.Path):
repo_dir = tmp_path
git_author = pygit2.Signature(name="foo", email="[email protected]")
repo = pygit2.init_repository(str(repo_dir))
workdir = pathlib.Path(repo.workdir)
readme = workdir / "README.md"
readme.write_text("commit0")
index = repo.index
index.add(readme.relative_to(workdir).as_posix())
index.write()
tree = index.write_tree()
commit0 = repo.create_commit("HEAD", git_author, git_author, "commit0", tree, [])
master_branch = repo.branches.local["master"]
old_master_branch = repo.branches.local.create("old_master", master_branch.peel())
readme.write_text("commit1")
index = repo.index
index.add(readme.relative_to(workdir).as_posix())
index.write()
tree = index.write_tree()
repo.create_commit(repo.head.name, git_author, git_author, "commit1", tree, [commit0])
repo.checkout(old_master_branch)
readme.write_text("commit2")
index = repo.index
index.add(readme.relative_to(workdir).as_posix())
index.write()
tree = index.write_tree()
repo.create_commit(repo.head.name, git_author, git_author, "commit2", tree, [commit0])
repo.checkout(master_branch)
# the staged area should be empty after checkout
assert not list(repo.index)
I tried it with git checkout master and it works fine without changing the staged area.
- Langage dominant
- Python
- Étoiles
- 1.7k
- Forks
- 408
- Merge moyen
- 2 j 57 min
- PR mergées (30 j)
- 7
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de libgit2/pygit2
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
-
Feature Request: Support app-level temporary config overrides using libgit2's backend supprtOuverte
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
-
merge_bases not wrappedOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
Toutes les issues de libgit2/pygit2
Issues similaires
-
correction metadata
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
acl-org/acl-anthology#10104 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug status/needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
prowler-cloud/prowler#12885 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Bug in GaussianTailProbabilityCalibrator: running_statistics=False still uses a windowed varianceOuvertebug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
selimfirat/pysad#107 ·
Les mainteneurs répondent en général sous 1 jour
-
bug ci-failure high priority
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
vllm-project/vllm-omni#8194 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour