Did `pwd` use to have a `-W` option?

299 Views Asked by At

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?

2

There are 2 best solutions below

0
adam.hendry On BEST ANSWER

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

0
Buttle Butkus On

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.