determine if the tree is dirty

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

 



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
--
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]