14 Commits

Author SHA1 Message Date
Johannes Schindelin
0c3ca441d7 filesystem(bashrc): avoid spawning an external process
In 73e06b9d4c (bash.bashrc: Update PS1 if PS1 wasn't exported. Closes
 #653, 2016-07-14), we updated `/etc/bash.bashrc` to avoid overriding
`PS1`, but the way it was done requires `cut.exe` to be in the `PATH`.

Now, while _most_ of the time we're running inside a login Bash where
the `PATH` has been appropriately modified, sometimes we don't. In that
case, `cut.exe` is not in the `PATH`.

We should not spawn a new process, anyway, as spawning processes is
really expensive in the MSYS2 runtime because of all the contortions
necessary to emulate the POSIX syscall `fork()`.

Let's just avoid that extra process by using `case`, which is a Bash
built-in and therefore won't cost much time to run.

This fixes https://github.com/git-for-windows/git/issues/3652

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-02-01 17:18:40 +01:00
Viktor Szakats
7f7316ba9b use HTTPS in URLs where supported (#1741) 2019-09-30 09:33:57 +03:00
Rafael Kitover
c31f18202d better support for Win10 OpenSSH server (#1375)
If msys2 bash is set as the DefaultShell for the Win10 OpenSSH server,
there is no way to pass -l to make it a login shell, so /etc/profile is
not sourced, PATH is not set, and the bashrc produces errors.

Detect this case in /etc/bash.bashrc, by checking for the SSH_CONNECTION
environment variable and PATH not having msys2 elements, and source
/etc/profile.
2018-08-08 08:46:00 +03:00
Алексей
8a2863f5f3 Revert "Taskbar-pinnable mintty" 2017-04-14 07:52:21 +03:00
Mihail Konev
59bd390b5e filesystem: add terminal cwd sequence to PS1 2017-03-05 22:07:26 +05:00
David Macek
74f9468ce4 filesystem: Fix case when getent isn't installed 2017-01-31 09:25:55 +01:00
David Macek
ae10fd86dd filesystem: Vary the prompt between regular '$' and bold '#'
Show '#' only if we can detect that the current process is
elevated.  It requires `group: db` enabled in /etc/nsswitch.conf.
2017-01-29 12:41:09 +01:00
Karlson2k
73e06b9d4c bash.bashrc: Update PS1 if PS1 wasn't exported.
Closes #653
2016-07-14 23:59:51 +03:00
Philip Oakley
17a6004301 bashrc: re-include $PS1 priority
6e6310d (filesystem: New specific variable MSYS2_PS1., 2016-05-01)
introduced the MSYS2_PS1 prompt script priority to allow multiple
device configurations.

Unfortunately, if MSYS2_PS1 was not set it overwrote the $PS1, even
when specifically set by the users configuration, such as provided in the
Git-for-Windows SDK (see https://github.com/git-for-windows/git/issues/794#issuecomment-227401839)
and the monkey patch fix (https://github.com/git-for-windows/build-extra/pull/122).

Introduce a priority order so that the user's $PS1 (if set) has an
intermediate priority between the MSYS2_PS1 and the default PS1.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2016-07-06 23:33:58 +01:00
Renato Silva
d81601b726 More environment improvements.
* Warning about required shortcut changes.
  When upgrading the filesystem package, user will be notified about the
  unified msys2_shell.cmd and asked for updating their shortcuts.

* New warning mechanism for interactive bash sessions.
  Applications can now add warnings to the terminal for notifying the
  user about possible problems. This is done by adding a file containing
  the warning text to one of the following locations:

      - /etc/profile.d/NAME.warning
      - /mingw32/etc/profile.d/NAME.warning
      - /mingw64/etc/profile.d/NAME.warning

  These files are processed by /etc/bash.bashrc. Files with the
  "warning.once" extension are removed after processing. An
  implementation example is provided by next change.

* Add simplified parameter -full-path to msys2_shell.cmd. The old
  parameter -use-full-path still works for now but is marked as
  deprecated using the above warning mechanism.

* Add file opening support to shell manager.
  Both directory and file arguments are now accepted and passed to
  Windows Explorer for opening with default application.

* Residual pkgrel updates.
2016-05-24 14:37:08 -03:00
Renato Silva
6e6310dd66 filesystem: New specific variable MSYS2_PS1.
Setting this variable now makes /etc/bash.bashrc use that as PS1 instead
of default value. This allows for configuration shared between MSYS2 and
other environments like Cygwin or MinGW.org MSYS to define a PS1 that is
specific to MSYS2 without manual detection of the system type.
2016-05-24 14:37:08 -03:00
David Macek
0a34180d2c filesystem: Added MSYSTEM to the default prompt 2014-11-19 21:26:57 +01:00
Alexpux
13fbdd1432 filesystem: Cleanup profile files from Cygwin stuff 2014-07-02 10:02:31 +04:00
Alexpux
4711f5800e filesystem: New package. Replace msys2-base 2014-07-01 15:36:35 +04:00