{"thread":{"id":"15832","subject":"[StGit PATCH 1/2] Handle \"git diff-tree --stdin\" error","startedAt":"2008-10-09T09:01:57Z","lastAt":"2008-10-09T09:02:02Z","messageCount":2,"participants":["Samuel Tardieu"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"92656","messageId":"20081009090157.12637.45887.stgit@arrakis.enst.fr","threadId":"15832","inReplyTo":null,"subject":"[StGit PATCH 1/2] Handle \"git diff-tree --stdin\" error","fromName":"Samuel Tardieu","fromEmail":"sam@rfc1149.net","sentAt":"2008-10-09T09:01:57Z","receivedAt":"2008-10-09T09:01:57Z","isPatch":true,"sender":{"key":"sam@rfc1149.net","avatar":"https://avatars.githubusercontent.com/u/44656?v=4"},"body":"If, for any reason, one of the SHA1 is not a commit object,\n\"git diff-tree --stdin\" will signal an error on its standard\nerror and will only issue the requested \"end\" pattern.\n\n\"stg diff\" could wait forver for the right references to\nhappen. With this patch, we now get:\n\n% stg diff\nstg diff: error: Object 6daaab2215a3d277a315d6938bdda86b2f75f6af not a commit\n---\n stgit/lib/git.py |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/stgit/lib/git.py b/stgit/lib/git.py\nindex 4f210f8..45c0b32 100644\n--- a/stgit/lib/git.py\n+++ b/stgit/lib/git.py\n@@ -579,10 +579,10 @@ class DiffTreeProcesses(object):\n         p.stdin.write(query + end)\n         p.stdin.flush()\n         s = ''\n-        while not (s.endswith('\\n' + end) or s.endswith('\\0' + end)):\n+        while not s.endswith(end):\n             s += os.read(p.stdout.fileno(), 4096)\n-        assert s.startswith(query)\n-        assert s.endswith(end)\n+        if not s.startswith(query):\n+            raise RepositoryException(os.read(p.stderr.fileno(), 4096))\n         return s[len(query):-len(end)]\n \n class Repository(RunWithEnv):\n"},{"id":"92657","messageId":"20081009090202.12637.2907.stgit@arrakis.enst.fr","threadId":"15832","inReplyTo":"20081009090157.12637.45887.stgit@arrakis.enst.fr","subject":"[StGit PATCH 2/2] Always resolve \"git describe\" to something","fromName":"Samuel Tardieu","fromEmail":"sam@rfc1149.net","sentAt":"2008-10-09T09:02:02Z","receivedAt":"2008-10-09T09:02:02Z","isPatch":true,"sender":{"key":"sam@rfc1149.net","avatar":"https://avatars.githubusercontent.com/u/44656?v=4"},"body":"Sometimes, \"git describe\" cannot describe the current version. Use\n\"--always\" so that we have a fallback.\n---\n stgit/version.py |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/stgit/version.py b/stgit/version.py\nindex d57053d..05fa8e9 100644\n--- a/stgit/version.py\n+++ b/stgit/version.py\n@@ -8,7 +8,7 @@ class VersionUnavailable(StgException):\n def git_describe_version():\n     path = sys.path[0]\n     try:\n-        v = run.Run('git', 'describe', '--tags', '--abbrev=4'\n+        v = run.Run('git', 'describe', '--tags', '--abbrev=4', '--always'\n                     ).cwd(path).output_one_line()\n     except run.RunException, e:\n         raise VersionUnavailable(str(e))\n"}]}