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

Re: Status of all files (was: Re: How can I tell if a file is ignored by git?

From
Eric Raymond <esr@thyrsus.com>
Date
Apr 9, 2010, 14:02 UTC
Message-ID
<20100409140215.GB27899@thyrsus.com>
In-Reply-To
<m3sk74hjkg.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com>:
> There is also
> 
>         git status --short

Not documented in my installed version, 1.6.3.3. Where can I go in the repo to read about this?

Show 12 quoted lines
> > Our canonical list (omitting two that apply only to locking systems)
> > is:
> > 
> >   'up-to-date        The working file is unmodified with respect to the
> >                      latest version on the current branch, and not locked.
> 
> In Git you don't have locking, but you have three versions: in the
> working area (the working file), in the index, and latest version on
> the current branch (the HEAD version).
> 
> So 'up-to-date in Git would probably mean working tree = cached = HEAD
> version.
Yes, that was what I thought.  Is this what ls-files is reporting as 'H'?  
(The ls-files -t codes need better documentation.  If I get detailed enough
answers, I will write some.)
 
Show 6 quoted lines
> > 
> >   'edited            The working file has been edited by the user.
> 
> Does this include stat-dirty files, i.e. if file has been modified
> (mtime), but the contents is the same in working file and in HEAD
> version?

No, it does not. Thank you for asking that question, I have just added a note about this to the VC code exactly where it will do the most good.

Show 13 quoted lines
> > 
> >   'needs-update      The file has not been edited by the user, but there is
> >                      a more recent version on the current branch stored
> >                      in the master file.
> 
> Needs *update* looks like it came from centralized VCS like CVS and
> Subversion, where you use update-the-commit method.  You can't say
> that HEAD version is more recent that working file...
> 
> The rought equivalent would be that upstream branch for current
> branch (e.g. 'origin/master' can be upstream for 'master' branch) is
> in fast-forward state i.e. current branch is direct ancestor of
> corresponding upstream branch, and the file was modified upstream.

Agreed. But there's no way to tell that this is the case without doing a pull operation or otherwise querying origin, and I'm not going to do that.

Explanation: My general rule for DVCS back ends is that the status commands
aren't allowed to do network operations, and it's OK for them not to
report a state code if that would be required.  This is so VC will fully
support disconnected operation when the VCS does.
I have, however, added a note to vc-git.el explaining that this is
possible if we ever teach the mode front end to behave differently when
it knows it has live Internet.  I might do this in the future.
 
Show 8 quoted lines
> > 
> >   'needs-merge       The file has been edited by the user, and there is also
> >                      a more recent version on the current branch stored in
> >                      the master file.  This state can only occur if locking
> >                      is not used for the file.
> 
> This, like 'needs-update, looks like it is relevant only in
> update-the-commit workflow centralized VCS.

Following your previous logic, I think it would make sense to set this if we could detect that the upstream of the current branch has forward commits touching this file. Again, this would require a network operation in the general case.

Show 6 quoted lines
> >   'conflict          The file contains conflicts as the result of a merge.
> 
> Note that with Git you can have other merge conflict than simple
> CONFLICT(contents).  With CONFLICT(rename/rename) for example the file
> would not contain textual conflict, so e.g. it won't have conflict
> markers, etc.

It is unclear what Emacs wants in this situation; I will try to find out. The documentation says this:

                     For now the conflicts are text conflicts.  In the
                     future this might be extended to deal with metadata
                     conflicts too.
I don't think anyone was thinking about rename/rename conficts...
 
> > I am unclear on what your "unmerged" (M) status means.
> 
> Probably 'conflict.
That was my best guess too.  Can anyone say more definitely?
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Previous: Jakub NarebskiNext: Matthieu Moy
Message 8 of 19 in “How can I tell if a file is ignored by git?”
  1. Eric RaymondApr 9, 2010
  2. Jacob HelwigApr 9, 2010
  3. Status of all files (was: Re: How can I tell if a file is ignored by git?Eric Raymond, Apr 9, 2010
  4. Randal L. SchwartzApr 9, 2010
  5. Eric RaymondApr 9, 2010
  6. Junio C HamanoApr 10, 2010
  7. Jakub NarebskiApr 9, 2010
  8. Eric RaymondApr 9, 2010
  9. Matthieu MoyApr 9, 2010
  10. Eric RaymondApr 9, 2010
  11. Junio C HamanoApr 9, 2010
  12. Jakub NarebskiApr 9, 2010
  13. Paolo BonziniApr 10, 2010
  14. Jeff KingApr 11, 2010
  15. Ramkumar RamachandraApr 9, 2010
  16. Ævar Arnfjörð BjarmasonApr 9, 2010
  17. Eric RaymondApr 9, 2010
  18. Daniel GraceApr 9, 2010
  19. Eric RaymondApr 10, 2010

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.