[StGit PATCH 1/2] Handle "git diff-tree --stdin" error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If, for any reason, one of the SHA1 is not a commit object,
"git diff-tree --stdin" will signal an error on its standard
error and will only issue the requested "end" pattern.

"stg diff" could wait forver for the right references to
happen. With this patch, we now get:

% stg diff
stg diff: error: Object 6daaab2215a3d277a315d6938bdda86b2f75f6af not a commit
---
 stgit/lib/git.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 4f210f8..45c0b32 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -579,10 +579,10 @@ class DiffTreeProcesses(object):
         p.stdin.write(query + end)
         p.stdin.flush()
         s = ''
-        while not (s.endswith('\n' + end) or s.endswith('\0' + end)):
+        while not s.endswith(end):
             s += os.read(p.stdout.fileno(), 4096)
-        assert s.startswith(query)
-        assert s.endswith(end)
+        if not s.startswith(query):
+            raise RepositoryException(os.read(p.stderr.fileno(), 4096))
         return s[len(query):-len(end)]
 
 class Repository(RunWithEnv):

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux