From 5520c0efb11271b663f813d236699c3c90ba02a1 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 25 Jan 2024 20:21:00 +0300 Subject: [PATCH] bin/git-open: Open browser window in private mode --- bin/git-open | 11 +++++++++-- bin/git-open-remote | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/git-open b/bin/git-open index b25e8d9..4cf5946 100755 --- a/bin/git-open +++ b/bin/git-open @@ -1,7 +1,12 @@ #! /bin/sh +if [ "x$1" = x-p ]; then + private="-p" + shift +fi + if [ $# -ne 1 ]; then - echo "Usage: git open url_key" >&2 + echo "Usage: git open [-p] url_key" >&2 exit 1 fi @@ -13,7 +18,9 @@ fi browser_section="`git config --get web.browser`" browser_cmd="`git config --get browser.\"$browser_section\".cmd`" -if [ -z "$browser_cmd" ]; then +if [ x"$private" = x-p ]; then + browser_cmd="webbrowser -p" +elif [ -z "$browser_cmd" ]; then browser_cmd="webbrowser -n" fi diff --git a/bin/git-open-remote b/bin/git-open-remote index 45c3a7e..9aa6a84 100755 --- a/bin/git-open-remote +++ b/bin/git-open-remote @@ -1,5 +1,10 @@ #! /bin/sh +if [ "x$1" = x-p ]; then + private="-p" + shift +fi + if [ -z "$1" ]; then branch="`git rev-parse --abbrev-ref HEAD`" remote="`git config --get branch.$branch.remote`" @@ -16,4 +21,4 @@ if [ -z "$remote" ]; then exit 1 fi -exec git-open remote.$remote.url +exec git-open $private remote.$remote.url -- 2.39.5