1

I am reviewing the source code for gitflow-avh (A VirtualHome edition), version 1.12.3, which ships with Git for Windows, version 2.31.1. I'm looking at lines 67-73 of the script git-flow.

*MINGW*)
    export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
    pwd () {
        builtin pwd -W
    }
    ;;
*)
    # The sed expression here replaces all backslashes by forward slashes.
    # This helps our Windows users, while not bothering our Unix users.)
    export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
    ;;
esac

What is the -W option? I'm only aware of -L and -P in bash. I'm fairly confident this is a "MINGW-ism", but I'm having trouble finding documentation online.

Does anyone know what the -W option does?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
adam.hendry
  • 4,458
  • 5
  • 24
  • 51
  • `through a dash (shell) script` How do you know it's a dash script? Might you give more information about the script and environment? – KamilCuk May 13 '21 at 16:12
  • @KamilCuk Sure, of course. I'm actually reviewing the source code for `gitflow-avh` (A VirtualHome edition), version 1.12.3, which ships with Git for Windows, version 2.31.1. I'm looking at lines 67-73 of `https://github.com/jackfrued/gitflow-avh/blob/develop/git-flow`. In know it's dash because of the shebang. – adam.hendry May 13 '21 at 16:33
  • @KamilCuk I'll update the question with this further information. – adam.hendry May 13 '21 at 16:34

2 Answers2

2

Ok, so I found this specifically has to do with MSYS2, as opposed to MINGW.

Per MSYS2's website, "How does MSYS2 differ from Cygwin?":

How_MSYS2_differs_from_Cygwin

I had to run MSYS2 itself to actually see what the -W option provided:

MSYS2_pwd_w_option

adam.hendry
  • 4,458
  • 5
  • 24
  • 51
0

In my "root" directory in Git Bash on Windows, pwd just gives me /.

But with -W, I get the real location:

$ pwd -W
C:/Program Files/Git

There's nothing on the man page for pwd, of course. Based on @A. Hendry's answer, I think I'll just alias pwd so that it always uses the -W option.

Buttle Butkus
  • 9,206
  • 13
  • 79
  • 120