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

Re: Retrieving a file at a before a specified commit

From
ELErik de Castro Lopo <mle+tools@mega-nerd.com>
Date
May 30, 2013, 00:49 UTC
Message-ID
<20130530104932.d7ba4bfb426044ab9653057e@mega-nerd.com>
In-Reply-To
<20130529075811.GA7204@sigill.intra.peff.net>
Jeff King wrote:
> Yes, that should work as long as the file is modified and not added. You
> can also say "4d77a3cee^:A/B/C" if you do not want to look up the parent
> id yourself.
Thanks, that's useful to know.
> Note that for a merge commit with multiple parents, the question is more
> complex, as there are two previous states that are merged.

This is not the case in the one I am currently looking at. There is a single parent commit.

> You say that it doesn't work in one particular case. What is that case?
> What happens?
Here is an example. Grab this repository:
    git clone git://github.com/qca/open-plc-utils.git
    cd open-plc-utils/
Look at this commit:
    git log --name-status f51ac745a6d4087cc4d77a3cee01db0412955c79

and notice that one of the files modified is "pib/chkpib2.7", so lets look at the parent version of that file:

    git show f51ac745a6d4087cc4d77a3cee01db0412955c79^:pib/chkpib2.7
which produces no output and exits with 0 status.

However looking at the diff for commit f51ac745a suggests that while the file pib/chkpib2.7 may have existed before that commit, it must have been empty (ie zero length).

Does this explanation make sense?
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
Previous: Jeff KingNext: Erik de Castro Lopo
Message 3 of 8 in “Retrieving a file at a before a specified commit”
  1. Erik de Castro LopoMay 29, 2013
  2. Jeff KingMay 29, 2013
  3. Erik de Castro LopoMay 30, 2013
  4. Erik de Castro LopoMay 30, 2013
  5. Junio C HamanoMay 30, 2013
  6. Erik de Castro LopoMay 30, 2013
  7. Jeff KingMay 30, 2013
  8. Erik de Castro LopoMay 30, 2013

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.