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

Re: [PATCH/RFC] diff --relative: output paths as relative to the current subdirectory

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2008, 23:43 UTC
Message-ID
<7vfxvx211k.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.1.00.0802121531170.2920@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 19 quoted lines
> On Tue, 12 Feb 2008, Junio C Hamano wrote:
>>
>> This adds --relative option to diff family.  When you start from
>> a subdirectory, 
>> 
>>  $ git diff --relative
>
> Ack, except I think it should allow you to actually *set* what the diff is 
> relative to.
>
> An example of that could be something like
>
> 	git diff --relative=drivers/scsi/ a..b -- drivers/scsi/
>
> where you aren't actually *in* that subdirectory, but for one reason or 
> another you're limiting the diff to just stuff in that subdirectory, and 
> want a diff that is relative to that one.
>
> Hmm?
Your example is shorter to type as:
	(cd drivers/scsi && git diff --relative a..b --)

Do you envision a useful case where --relative=<foo> does not cover the pathspec you give? IOW, with the "temporarily chdir there" approach, you cannot express:

	git diff --relative=block/ a..b -- drivers/scsi
but I do not think it is useful.  On the other hand,
	git diff --relative=drivers a..b -- drivers/scsi
does make sense but again that is:
	(cd drivers && git diff --relative a..b -- scsi/)
So...
Previous: Linus TorvaldsNext: Linus Torvalds
Message 3 of 8 in “diff --relative: output paths as relative to the current subdirectory”
  1. diff --relative: output paths as relative to the current subdirectoryJunio C Hamano, Feb 12, 2008
  2. Linus TorvaldsFeb 12, 2008
  3. Junio C HamanoFeb 12, 2008
  4. Linus TorvaldsFeb 12, 2008
  5. Linus TorvaldsFeb 13, 2008
  6. Junio C HamanoFeb 13, 2008
  7. Junio C HamanoFeb 13, 2008
  8. Junio C HamanoFeb 13, 2008

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.