* [StGit PATCH 1/2] Handle "git diff-tree --stdin" error
@ 2008-10-09 9:01 Samuel Tardieu
2008-10-09 9:02 ` [StGit PATCH 2/2] Always resolve "git describe" to something Samuel Tardieu
0 siblings, 1 reply; 2+ messages in thread
From: Samuel Tardieu @ 2008-10-09 9:01 UTC (permalink / raw)
To: git
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):
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [StGit PATCH 2/2] Always resolve "git describe" to something
2008-10-09 9:01 [StGit PATCH 1/2] Handle "git diff-tree --stdin" error Samuel Tardieu
@ 2008-10-09 9:02 ` Samuel Tardieu
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Tardieu @ 2008-10-09 9:02 UTC (permalink / raw)
To: git
Sometimes, "git describe" cannot describe the current version. Use
"--always" so that we have a fallback.
---
stgit/version.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stgit/version.py b/stgit/version.py
index d57053d..05fa8e9 100644
--- a/stgit/version.py
+++ b/stgit/version.py
@@ -8,7 +8,7 @@ class VersionUnavailable(StgException):
def git_describe_version():
path = sys.path[0]
try:
- v = run.Run('git', 'describe', '--tags', '--abbrev=4'
+ v = run.Run('git', 'describe', '--tags', '--abbrev=4', '--always'
).cwd(path).output_one_line()
except run.RunException, e:
raise VersionUnavailable(str(e))
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-09 9:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 9:01 [StGit PATCH 1/2] Handle "git diff-tree --stdin" error Samuel Tardieu
2008-10-09 9:02 ` [StGit PATCH 2/2] Always resolve "git describe" to something Samuel Tardieu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).