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

Re: [HELP] Adding git awareness to the darning patch management system.

From
Jeff King <peff@peff.net>
Date
Nov 30, 2011, 07:22 UTC
Message-ID
<20111130072248.GG5317@sigill.intra.peff.net>
In-Reply-To
<4ED59232.3000807@users.sourceforge.net>
On Wed, Nov 30, 2011 at 12:17:22PM +1000, Peter Williams wrote:
> 1. presenting the file tree of the sources being patched in a way
> that makes sense to the user including the current status of files
> from the point of view of the underlying SCM (in this case, git), and
I'm not exactly sure what this means.
Show 5 quoted lines
> 2. detecting files with uncommitted changes (from the SCM's point of
> view) when the user adds them to a patch (or pushes a patch that
> contains them) so that they may be alerted to the fact and offered
> the choice of absorbing the uncommitted changes into the patch (or
> not).

For this, you probably want "git diff-files --name-only", which will show files with differences in the working tree. Keep in mind that git has an "index" or "staging area", which means that you have three states of content for a given path:

  1. the state of the prior commit (i.e., HEAD)
  2. the state that is marked to be committed when "git commit" is run
     (i.e., the index)
  3. the state in the working tree

You can compare the first two with "git diff-index", and the latter two with "git diff-files". You can also use "git status --porcelain" to get a machine-readable output that shows how the three states match up, with one line per file.

> I've already implemented this interface for Mercurial (with which I
> am familiar) and looked at doing the same with git but had difficulty
> discovering the definitive mechanisms for obtaining the necessary
> data.  So I'm soliciting your help in overcoming these problems.

I hope the above helps you some. If not, just ask. It might be easier to understand what you are looking for if you can give concrete examples.

-Peff
Previous: Peter WilliamsNext: Peter Williams
Message 2 of 8 in “[HELP] Adding git awareness to the darning patch management system.”
  1. Peter WilliamsNov 30, 2011
  2. Jeff KingNov 30, 2011
  3. Peter WilliamsDec 1, 2011
  4. Jeff KingDec 1, 2011
  5. Peter WilliamsDec 1, 2011
  6. Jeff KingDec 1, 2011
  7. Tay Ray ChuanNov 30, 2011
  8. Peter WilliamsNov 30, 2011

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.