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?



--- System information. ---
Architecture: amd64
Kernel: Linux 3.2.0-3-amd64

Debian Release: wheezy/sid
990 unstable ftp.fr.debian.org
500 testing ftp.fr.debian.org
500 stable ftp.fr.debian.org
1 experimental ftp.fr.debian.org

--- Package information. ---
Depends (Version) | Installed
===========================-+-==============
python2.7 | 2.7.3-5
OR python2.6 | 2.6.8-0.2
python (>= 2.6.6-7~) | 2.7.3-2
python (<< 2.8) | 2.7.3-2
libc6 (>= 2.2.5) |


Recommends (Version) | Installed
================================-+-===========
python-fastimport | 0.9.2-1


Suggests (Version) | Installed
=================================-+-===========
python-dulwich-dbg |


--
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