#!/bin/bash
# Get current path in Windows format
if command -v "cygpath" > /dev/null; then
  # We have cygpath to do the conversion
  ATOMCMD=$(cygpath "$(dirname "$0")/atom.cmd" -a -w)
else
  pushd "$(dirname "$0")" > /dev/null
  if [[ $(uname -r) == *-Microsoft ]]; then
    # We are in Windows Subsystem for Linux, map /mnt/drive
    ATOMCMD="$(echo $PWD | sed 's/\/mnt\/\([a-z]*\)\(.*\)/\1:\2/')/atom.cmd"
    ATOMCMD="${ATOMCMD////\\}"
  else
    # We don't have cygpath or WSL so try pwd -W
    ATOMCMD="$(pwd -W)/atom.cmd"
  fi
  popd > /dev/null
fi
if [ "$(uname -o)" == "Msys" ]; then
  cmd.exe //C "$ATOMCMD" "$@" # Msys thinks /C is a Windows path...
else
  cmd.exe /C "$ATOMCMD" "$@" # Cygwin does not
fi

#!/bin/bash
# Get current path in Windows format
if command -v "cygpath" > /dev/null; then
  # We have cygpath to do the conversion
  ATOMCMD=$(cygpath "$(dirname "$0")/atom.cmd" -a -w)
  ARGS=( $(cygpath -a -w "$@" | tr '\n' ' ') ) 
else
  ARGS=$@
  pushd "$(dirname "$0")" > /dev/null
  if [[ $(uname -r) == *-Microsoft ]]; then
    # We are in Windows Subsystem for Linux, map /mnt/drive
    ATOMCMD="$(echo $PWD | sed 's/\/mnt\/\([a-z]*\)\(.*\)/\1:\2/')/atom.cmd"
    ATOMCMD="${ATOMCMD////\\}"
  else
    # We don't have cygpath or WSL so try pwd -W
    ATOMCMD="$(pwd -W)/atom.cmd"
  fi
  popd > /dev/null
fi
if [ "$(uname -o)" == "Msys" ]; then
  cmd.exe //C "$ATOMCMD" "${ARGS[@]}" # Msys thinks /C is a Windows path...
else
  cmd.exe /C "$ATOMCMD" "${ARGS[@]}" # Cygwin does not
fi

Convert arguments to absolute paths
Convert arguments to absolute paths

This script launches cmd and has it launch atom with the passed arguments. The problem is that cmd will not (necessarily) start in the pwd. So, relative paths like `.` and `..` have a different meaning. So we should first convert them to absolute paths with cygpath. 

Try it yourself. Go to some directory in bash and run `atom .` Rather than opening your current bash pwd, you'll open $HOME because when cmd opens, that's where it will be. Now apply this change and try the same thing. 

By the way, I only see this problem affecting MSysGit and MSys2. I can't say whether it affects other environments.