forwarded 688354 https://bugs.launchpad.net/dulwich/+bug/842694
tags 688354 +upstream
tags 688354 +confirmed
thanks

Am Saturday, den 22.09.2012, 00:48 +0200 schrieb Samuel Hym:
> Package: python-dulwich
> Version: 0.8.5-2
> Severity: normal
> 
> Executing the following sequence:
> - git init
> - updating refs/heads/master from dulwich
> - git stash
> ends up in a failed stashing.
> 
> More precisely, the following code fails, with the message shown in comment.
> 
> #!/usr/bin/python
> 
> # -*- coding: UTF-8 -*-
> 
> import os
> 
> import time
> 
> import dulwich
> 
> def git_commit_tree(repo, ref, tree):
> 
>      new_commit = dulwich.objects.Commit()
> 
>      new_commit.tree = tree.id
> 
>      if ref in repo:
> 
>          new_commit.parents = [repo[ref].id]
> 
>      else:
> 
>          new_commit.parents = []
> 
>      config = repo.get_config_stack()
> 
>      author = '{}<{}>'.format(config.get('user', 'name'), config.get('user', 
> 'email'))
> 
>      new_commit.author = new_commit.committer = author
> 
>      new_commit.commit_time = new_commit.author_time = int(time.time())
> 
>      if time.daylight == 1:
> 
>          new_commit.commit_timezone = \
> 
>              new_commit.author_timezone = - time.altzone
> 
>      else:
> 
>          new_commit.commit_timezone = \
> 
>              new_commit.author_timezone = - time.timezone
> 
>      new_commit.encoding = "UTF-8"
> 
>      new_commit.message = 'Generated'
> 
>      repo.object_store.add_object(new_commit)
> 
>      repo.refs[ref] = new_commit.id
> 
> os.system('git init /tmp/dulwich-bug-repo')
> 
> # Returns:
> 
> #
> 
> # Initialized empty Git repository in /tmp/dulwich-bug-repo/.git/
> 
> repo = dulwich.repo.Repo('/tmp/dulwich-bug-repo')
> 
> blob = dulwich.objects.Blob.from_string('blob content')
> 
> repo.object_store.add_object(blob)
> 
> tree = dulwich.objects.Tree()
> 
> tree.add('f', 0100644, blob.id)
> 
> repo.object_store.add_object(tree)
> 
> git_commit_tree(repo, 'refs/heads/master', tree)
> 
> os.chdir('/tmp/dulwich-bug-repo')
> 
> os.system('git status')
> 
> # Returns:
> 
> #
> 
> # # On branch master
> 
> # # Changes to be committed:
> 
> # #   (use "git reset HEAD<file>..." to unstage)
> 
> # #
> 
> # #    deleted:    f
> 
> # #
> 
> os.system('git stash')
> 
> # Returns:
> 
> #
> 
> # /usr/lib/git-core/git-stash: line 232: 
> /tmp/dulwich-bug-repo/.git/logs/refs/stash: No such file or directory
> 
> 
> since the commit code is more or less taken from the tutorial 
> http://www.samba.org/~jelmer/dulwich/docs/tutorial/object-store.html I 
> suppose that the repository should be left in a consistent state after 
> that execution, no?
dulwich doesn't support the reflog yet, and doesn't update it. It looks
like git stash relies on the reflog to exist.

Cheers,

Jelmer


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to