From: Adam Mercer <ramercer@gmail.com>
To: git@vger.kernel.org
Subject: determine if the tree is dirty
Date: Tue, 3 Nov 2009 12:57:37 -0600 [thread overview]
Message-ID: <799406d60911031057l5dcb4d4fi3705cc66997ff7f7@mail.gmail.com> (raw)
Hi
As part of a python script I need to determine if a tree has any
uncommitted changes, so far I am been using:
# determine tree status
status_cmd = 'git status'
status_output = run_external_command(status_cmd,
honour_ret_code=False)[1].strip()
if status_output.endswith('no changes added to commit (use "git add"
and/or "git commit -a")'):
git_status = 'UNCLEAN: Some modifications not committed'
else:
git_status = 'CLEAN: All modifications committed'
but I feel that this relies to heavily on the porcelain and that there
should be a better way to accomplish this without relying on parsing
the output of git-status.
Does anyone know of a better way to accomplish this?
Cheers
Adam
next reply other threads:[~2009-11-03 18:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-03 18:57 Adam Mercer [this message]
2009-11-03 19:06 ` determine if the tree is dirty Jeff Epler
2009-11-03 19:19 ` Junio C Hamano
2009-11-03 19:30 ` Adam Mercer
2009-11-03 21:07 ` Markus Hitter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=799406d60911031057l5dcb4d4fi3705cc66997ff7f7@mail.gmail.com \
--to=ramercer@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).