git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* GIT_EXTERNAL_DIFF invoked with undocumented calling convention after unstashing conflicts
@ 2007-09-30 19:17 Bruno Haible
  2007-09-30 19:59 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2007-09-30 19:17 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]

Hi,

"git diff --uncached" invokes the GIT_EXTERNAL_DIFF variable with just one
argument (instead of 7 arguments, as documented) in a particular situation:
when there are conflicts after "git stash apply".

To reproduce:
  - Set environment variable GIT_EXTERNAL_DIFF to point to the attached
    script.
  - Make a clean gnulib checkout, 1 day old.
  - Add a entry to the top of the ChangeLog.
  - $ git pull
    fails due a conflict.
  - $ git stash
  - $ git pull
  - $ git stash apply
  - $ git-diff --cached | cat
    yields:
my-diff-for-git ChangeLog
diff --cc ChangeLog
index 443ad76,991c26b..0000000
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,7 -1,6 +1,11 @@@
  2007-09-30  Bruno Haible  <bruno@clisp.org>
  
++<<<<<<< Updated upstream:ChangeLog
 +      * tests/test-getaddrinfo.c (AF_UNSPEC): Provide a fallback definition.
 +      Needed on BeOS.
++=======
+       * Some other changes.
++>>>>>>> Stashed changes:ChangeLog
  
  2007-09-30  Bruno Haible  <bruno@clisp.org>
  

As you can see from the output of the script's line 2, it was called with
just one argument. This is not enough information for producing output
in a different way than the built-in way - defeating the purpose of
GIT_EXTERNAL_DIFF.

Can the GIT_EXTERNAL_DIFF invocation be done with 7 or more arguments?
It'd be OK to extend the calling convention.

Bruno

[-- Attachment #2: my-diff-for-git --]
[-- Type: application/x-shellscript, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GIT_EXTERNAL_DIFF invoked with undocumented calling convention after unstashing conflicts
  2007-09-30 19:17 GIT_EXTERNAL_DIFF invoked with undocumented calling convention after unstashing conflicts Bruno Haible
@ 2007-09-30 19:59 ` Junio C Hamano
  2007-09-30 21:25   ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-09-30 19:59 UTC (permalink / raw)
  To: Bruno Haible; +Cc: git

> "git diff --uncached" invokes the GIT_EXTERNAL_DIFF variable with just one
> argument (instead of 7 arguments, as documented) in a particular situation:

You are looking at an unmerged path.

    'GIT_EXTERNAL_DIFF'::
            When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
            program named by it is called, instead of the diff invocation
            described above.  For a path that is added, removed, or modified,
            'GIT_EXTERNAL_DIFF' is called with 7 parameters:

    ...
    +
    For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
    parameter, <path>.

The script needs to decide how it wants to present an unmerged
path; the information on each unmerged stages can be read from
the output of "ls-files -u $thatpath".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GIT_EXTERNAL_DIFF invoked with undocumented calling convention after unstashing conflicts
  2007-09-30 19:59 ` Junio C Hamano
@ 2007-09-30 21:25   ` Bruno Haible
  0 siblings, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2007-09-30 21:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> The script needs to decide how it wants to present an unmerged
> path; the information on each unmerged stages can be read from
> the output of "ls-files -u $thatpath".

Thanks for this info. This, and "git cat-file", did the trick.

Bruno

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-30 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-30 19:17 GIT_EXTERNAL_DIFF invoked with undocumented calling convention after unstashing conflicts Bruno Haible
2007-09-30 19:59 ` Junio C Hamano
2007-09-30 21:25   ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).