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

Re: Git commit path vs rebase path

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2012, 17:25 UTC
Message-ID
<7v1umuwpo9.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vhavqwqpz.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 31 quoted lines
> Steven Penny <svnpenn@gmail.com> writes:
>
>> Johannes Sixt wrote:
>>> Are you saying that the new pwd function will also be used on Cygwin? That
>>> would be a bug.
>>
>> The linked patch should fix the problem for _MinGW_ users.
>>
>> The problem will persist with _Cygwin_ users.
>
> What does a full pathname, fed as a parameter when invoking Windows native
> binaries like notepad, look like in a Cygwin environment?  That is, if you
> are writing a bash script that is meant to run in a Cygwin environment,
> and if the script takes the name of a file in the current directory, but
> it needs to chdir around for its own reasons before spawning notepad on
> the file, i.e.
>
> 	#!/bin/bash
> 	file="$(pwd)/$1"
>         ...
>         cd ..some..where..else..you..have..no..control..over
>         notepad "$file"
>
> what is the right incantation to replace `pwd` in 'file="$(pwd)/$1"'
> above?
>
> Whatever that is, using that instead of `pwd` in git-sh-setup.sh here:
>
> 	test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
>
> would be the solution.

Actually, the above is stated rather poorly. The path that ends up in $file must be usable by both Windows native and Cygwin programs, as the user may be using "vi" from Cygwin, or "notepad" like your example.

If there is no way to formulate $file to be acceptable for both, I do not see any sane solution other than one side compromising for the rest, perhaps by having

	$ cat >notepad.sh <<\EOF
        file=$(cygpath -m "$1") && exec notepad.exe "$file"
        EOF
on the end-user side, or something like that.
Previous: Junio C HamanoNext: Steven Penny
Message 8 of 32 in “Git commit path vs rebase path”
  1. Steven PennyMay 6, 2012
  2. Junio C HamanoMay 7, 2012
  3. Johannes SixtMay 8, 2012
  4. Steven PennyMay 8, 2012
  5. Johannes SixtMay 8, 2012
  6. Steven PennyMay 8, 2012
  7. Junio C HamanoMay 8, 2012
  8. Junio C HamanoMay 8, 2012
  9. Steven PennyMay 8, 2012
  10. Junio C HamanoMay 9, 2012
  11. Steven PennyMay 9, 2012
  12. Ramsay JonesMay 10, 2012
  13. Steven PennyMay 11, 2012
  14. Ramsay JonesMay 13, 2012
  15. Steven PennyMay 13, 2012
  16. Johannes SixtMay 14, 2012
  17. Ramsay JonesMay 15, 2012
  18. Johannes SixtMay 16, 2012
  19. Ramsay JonesMay 17, 2012
  20. Junio C HamanoMay 17, 2012
  21. 0/2 Re: Git commit path vs rebase pathJunio C Hamano, May 16, 2012
  22. 1/2 git-sh-setup: define workaround wrappers before they are usedJunio C Hamano, May 16, 2012
  23. Ramsay JonesMay 17, 2012
  24. 2/2 git-sh-setup: work around Cygwin path handling gotchasJunio C Hamano, May 16, 2012
  25. Steven PennyMay 16, 2012
  26. Junio C HamanoMay 16, 2012
  27. Ramsay JonesMay 17, 2012
  28. Junio C HamanoMay 18, 2012
  29. Steven PennyMay 19, 2012
  30. Ramsay JonesMay 21, 2012
  31. Junio C HamanoMay 21, 2012
  32. Ramsay JonesMay 24, 2012

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.