git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to check repository/working tree status from a script

From
MHMarc Haber <mh+git@zugschlus.de>
Date
May 20, 2009, 14:27 UTC
Message-ID
<20090520142742.GB15453@torres.zugschlus.de>
In-Reply-To
<alpine.LFD.2.01.0905190920051.3301@localhost.localdomain>
On Tue, May 19, 2009 at 09:29:08AM -0700, Linus Torvalds wrote:
Show 10 quoted lines
> IOW, something like this:
> 
> 	# any staged changes (ready to commit)
> 	git diff --quiet --staged || echo Staged changes
> 
> 	# any changes wrt the index (not staged)
> 	others=$(git ls-files --exclude-standard -o -d -m -u)
> 	[ -z "$others" ] || echo "Other changes"
> 
> should do it.
This looks good.
Show 9 quoted lines
> If you want more specificity wrt the "Other changes", you can add the "-t" 
> flag to git ls-files and parse the output to see whether the listed files 
> were just unknown (ie new files): '?', changed: 'C', removed: 'R' or need 
> to be merged: 'M'
> 
> Of course, 'git diff [--staged]' is needed if you actually want to know 
> some "deeper" patterns about _how_ things were changed. IOW, if you want 
> to know about renames/copies, you need to use 'git diff -M/C' to get that 
> kind of information.
Thanks. It's ok to just barf if there are any changes.

Background info: the data being version controlled is not source, but configuration for one system which is collaboratively maintained. There is a script which takes the currently checked out working tree, "compiles" it into the actual configuration and rsyncs/activates the actual configuration to the (one) target system. I would like to make sure that if one of the admins runs this script, she has (a) pulled all changes that others may have pushed to the central repository and (b) all her local changes are actually committed to her local repository and (c) pushed to the central repository.

Greetings Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

Bitte beachten Sie, daß dem [m.E. grundgesetzwidrigen] Gesetz zur
Vorratsdatenspeicherung zufolge, seit dem 1. Januar 2008 jeglicher
elektronische Kontakt (E-Mail, Telefongespräche, SMS, Internet-
Telefonie, Mobilfunk, Fax) mit mir oder anderen Nutzern verdachts-
unabhängig für den automatisierten geheimen Zugriff durch Strafver-
folgungs- u. Polizeivollzugsbehörden, die Bundesanstalt für Finanz-
dienstleistungsaufsicht, Zollkriminal- und Zollfahndungsämter,die
Zollverwaltung zur Schwarzarbeitsbekämpfung, Notrufabfragestellen,
Verfassungsschutzbehörden, den Militärischen Abschirmdienst, Bundes-
nachrichtendienst sowie 52 Staaten wie beispielsweise Aserbeidschan
oder die USA sechs Monate lang gespeichert wird, einschließlich der
Kommunikation mit Berufsgeheimnisträgern wie Ärzten, Journalisten und
Anwälten. Mehr Infos zur totalen Protokollierung Ihrer Kommunikations-
daten auf www.vorratsdatenspeicherung.de. (leicht verändert übernommen
kopiert von www.lawblog.de)
Previous: Linus TorvaldsNext: Marc Haber
Message 8 of 15 in “How to check repository/working tree status from a script”
  1. Marc HaberMay 19, 2009
  2. Tony FinchMay 19, 2009
  3. Marc HaberMay 19, 2009
  4. Tony FinchMay 19, 2009
  5. Marc HaberMay 20, 2009
  6. Linus TorvaldsMay 19, 2009
  7. Linus TorvaldsMay 19, 2009
  8. Marc HaberMay 20, 2009
  9. Marc HaberMay 20, 2009
  10. Santi BéjarMay 20, 2009
  11. Johannes SixtMay 20, 2009
  12. Marc HaberMay 20, 2009
  13. Marc HaberMay 21, 2009
  14. Jeff KingMay 21, 2009
  15. Marc HaberMay 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.