From patchwork Fri Aug 4 04:08:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13341232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525E8C001DE for ; Fri, 4 Aug 2023 04:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbjHDEIw (ORCPT ); Fri, 4 Aug 2023 00:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbjHDEIt (ORCPT ); Fri, 4 Aug 2023 00:08:49 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 853131BD for ; Thu, 3 Aug 2023 21:08:48 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe4b45a336so189635e9.1 for ; Thu, 03 Aug 2023 21:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691122126; x=1691726926; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ap1MM7SH0nAcizow+cdIe3UsmsTi3G/1lBsnss43fRM=; b=T3jjf3Dqt0X5DCPpPOdzh+n+FjHf/uTcZPhVlTABFcO/z3lxrtqJfYJxMetc0dyEfe 1EAaCvnxInGFMi4c2h8rkO/jaPPfWM7EYgu2VQ21wV7Zh1EGH1MPEYttZwhWnimQ2lx1 eoe2KHBAD6LN/2YP6JLsw6KQW7JpXkt6iu3yaBPCCGezy/gqZ3cQY5/43KWzraLSTjp+ fHTbquNryWb93xtnTKgiGi2t6QJymTg08pCsc4hTVP34G0S0uXWVVYbebme7TWk4X/fy BhznxCqnRNsjhGWDX/pcDcW5KpHJDXQy/WrKlRGGRiQSFYDT+0ZjyWacYhVU5adBu20f UpZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691122126; x=1691726926; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ap1MM7SH0nAcizow+cdIe3UsmsTi3G/1lBsnss43fRM=; b=jP+0U03OHMtPz0aErz1HDT9J1t32+VjQexCqzXMaPPmZpcWJrJLOr9hHJtm8ZPNp/d FZDwavnTxAFksDzWIASYdTBLHOTv7t4pD1ocdqbB3ttKYDD5JMXtkMmaLvZrW5BScCCX qOB4tEffec32KuF5M0cxlBZ+1Z1hkwImR17Onc1kfs+yaqviOq5Pl0hbPxughxLYKGlz 95xubZvKS5jOsPcCvsatzC0Z+hgLO+rqJK1uJ8Tl+/Qd2uenKHDNlwlwKJOciHo7Nau5 MkJNrWZu2WC28HWt2C7Bm992Kv3VumLjlw9mYq3YY0ORb9MAmIWuxJg6Tn/89f5KhNzO 1hcg== X-Gm-Message-State: AOJu0YxKPmXpLThov1Jv8N7KAap5AffJSCNBeDe+gZfXrFdrNK8ufnAj Lweim6DTgFAICK2ksgtOaieyLeaby24= X-Google-Smtp-Source: AGHT+IH8wykpMSJX0Fu1IFb4o6ep4iI4BsAQzAS0Py0yqsLVlxRCEoTTljDrlHEebgcrwUnQGGl58Q== X-Received: by 2002:a05:600c:212:b0:3fb:ef86:e30 with SMTP id 18-20020a05600c021200b003fbef860e30mr494270wmi.10.1691122126364; Thu, 03 Aug 2023 21:08:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b17-20020a05600010d100b003141e9e2f81sm1402245wrx.4.2023.08.03.21.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 21:08:46 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Fri, 04 Aug 2023 04:08:42 +0000 Subject: [PATCH v2 1/3] run-command: conditionally define locate_in_PATH() MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= This commit doesn't change any behaviour by itself, but allows us to easily define compat replacements for locate_in_PATH(). It prepares us for the next commit that adds a native Windows implementation of locate_in_PATH(). Signed-off-by: Matthias Aßhauer --- run-command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run-command.c b/run-command.c index 60c94198664..85fc1507288 100644 --- a/run-command.c +++ b/run-command.c @@ -170,6 +170,7 @@ int is_executable(const char *name) return st.st_mode & S_IXUSR; } +#ifndef locate_in_PATH /* * Search $PATH for a command. This emulates the path search that * execvp would perform, without actually executing the command so it @@ -218,6 +219,7 @@ static char *locate_in_PATH(const char *file) strbuf_release(&buf); return NULL; } +#endif int exists_in_PATH(const char *command) { From patchwork Fri Aug 4 04:08:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13341235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8585EC04A94 for ; Fri, 4 Aug 2023 04:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbjHDEJA (ORCPT ); Fri, 4 Aug 2023 00:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbjHDEIu (ORCPT ); Fri, 4 Aug 2023 00:08:50 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71D8B1BF6 for ; Thu, 3 Aug 2023 21:08:49 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe2ba3e260so16661865e9.2 for ; Thu, 03 Aug 2023 21:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691122127; x=1691726927; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FUi6jFQp8L/llj4/EsTykhKwkXSIppO/CWNsJgzWcqw=; b=d6c8Ft8r+XPBHqyKpUuQgPgovPkKMyct8v6RrAFbmgu1+qlgwn5IER9wtsqpY8rN/J wg4A0ak7+IL4tKlgevHQCSP3N2eZUfhQ1ve3b0CHNwdGXuzgJEbAzujnsyj6SlMUizR1 91SYbI3eXKEnL5KrFd7Z8yDdLkmgra8fB+NAraVUh6upfkFEYDjT6P2V5LPzF9Xg3/Z3 yf4miwKvctDUSucejdWs8PymuEvu+5QKGiImCF2Q3UdgjVLmNAcfpjz1dAyAs/FhbTMn uU08uJdq3y/IiqpA7uX7BMJ8ok9h6azRqor4miyGnd/oisBdQSd9SpyGs6w9fZ1y2yFY oOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691122127; x=1691726927; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FUi6jFQp8L/llj4/EsTykhKwkXSIppO/CWNsJgzWcqw=; b=gk8Cwc6MrsRJHPAWez2NIczADKO7LrtgHkZm/4Ks8ybjtFTL6sCKXR5LcjiyswpHo6 LO9d/Lijf9FvbletCe8TnE3gPklSfaIQnUzoqLu/fmyWuJrL/ih7FcbacrW4h2SUME85 GhNsv4tgU8NZfr0nCrU0Lcp/jdXGOjuzWX84oIDZfaggQpZJyOeMXxVv6AjmwfN5jpfa tOrcAmD083wYQ38DPIS8zGKuyVPg/FBzW12xD/EHXOu0zSQn6cCCE2IryZ3OPbF+YdSm TqzbACGHEf4WBd+QBwE5Mf+XTdHd3zq7JRgmoduhzbjGCUtdJmZCGQzFzGP3ufNfouY1 2Lgw== X-Gm-Message-State: AOJu0YwfWBEfLPgrP+GhHdzr5cj2AkKa0E04ouqQrsDb4PrRLDSulQo8 u+WlpZqNRrIO1tAwd6Hs3MdIj8amtLY= X-Google-Smtp-Source: AGHT+IE3JFbv4UYx60PyIAUJXmhWud7jys9r8v8zESHdtAXm+eNJXgNM92iCWQU6otEEL36n/jk+Ww== X-Received: by 2002:adf:e652:0:b0:313:ef24:6feb with SMTP id b18-20020adfe652000000b00313ef246febmr329526wrn.3.1691122127469; Thu, 03 Aug 2023 21:08:47 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00317731a6e07sm1382364wrw.62.2023.08.03.21.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 21:08:46 -0700 (PDT) Message-ID: <8b8c8c3f70a25f198335e36dfd501ffcb9d411c3.1691122124.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 04 Aug 2023 04:08:43 +0000 Subject: [PATCH v2 2/3] compat/mingw: implement a native locate_in_PATH() MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= since 5e1f28d (bisect--helper: reimplement `bisect_visualize()` shell function in C, 2021-09-13) `git bisect visualize` uses exists_in_PATH() to check wether it should call `gitk`, but exists_in_PATH() relies on locate_in_PATH() which currently only understands POSIX-ish PATH variables (a list of paths, separated by colons) on native Windows executables we encounter Windows PATH variables (a list of paths that often contain drive letters (and thus colons), separated by semicolons). Luckily we do already have a function that can lookup executables on windows PATHs: path_lookup(). Implement a small replacement for the existing locate_in_PATH() based on path_lookup(). Reported-by: Louis Strous Signed-off-by: Matthias Aßhauer --- compat/mingw.c | 5 +++++ compat/mingw.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index d06cdc6254f..bc3669d2986 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1347,6 +1347,11 @@ static char *path_lookup(const char *cmd, int exe_only) return prog; } +char *mingw_locate_in_PATH(const char *cmd) +{ + return path_lookup(cmd, 0); +} + static const wchar_t *wcschrnul(const wchar_t *s, wchar_t c) { while (*s && *s != c) diff --git a/compat/mingw.h b/compat/mingw.h index 209cf7cebad..b5262205965 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -175,6 +175,9 @@ pid_t waitpid(pid_t pid, int *status, int options); #define kill mingw_kill int mingw_kill(pid_t pid, int sig); +#define locate_in_PATH mingw_locate_in_PATH +char *mingw_locate_in_PATH(const char *cmd); + #ifndef NO_OPENSSL #include static inline int mingw_SSL_set_fd(SSL *ssl, int fd) From patchwork Fri Aug 4 04:08:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13341234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C74C001DE for ; Fri, 4 Aug 2023 04:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232225AbjHDEI5 (ORCPT ); Fri, 4 Aug 2023 00:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbjHDEIu (ORCPT ); Fri, 4 Aug 2023 00:08:50 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C831E2726 for ; Thu, 3 Aug 2023 21:08:49 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso17023925e9.0 for ; Thu, 03 Aug 2023 21:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691122128; x=1691726928; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=kJEE75AEEnlWKw6Me7rjDTo7oFzL5qfHsY65jpCTSDo=; b=rVne3IgXV+Zx5x4G1J3swXC4Cmc9aiU99t4zBvG/0uL9HRShvVlJfAppecRVGJziQ7 yKtE5puExsKZgINQuZyT3+81ROPKHZ1SeqxmmOPRn/Z7eDFdgqScR+tsvREMjou325jY KYKwP2SVuIpJ28nZXl86NPPh6uYDRgtmqdkSi3N+W/ocP6UJlImh+HhXCuHEhRPgXImy YdriIoPo+UcN9TZNMjP9XLRZV5+h9knRU6gyQRwd6uf1gwNIehBig3raEi+iuT6ytGXd cHyLW49Ge9SaB6Dc7Lrq4+XzDochItcu6Ha79q1TIw5tab9FmJ75GXhJLJIxSh2u/Ike 6jRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691122128; x=1691726928; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kJEE75AEEnlWKw6Me7rjDTo7oFzL5qfHsY65jpCTSDo=; b=EiMfCKjRTn/mInarjpWsg8glcFGCQx9jJpRZP6e9JYx9lAqWZwjrtNr5WjwDsIATRB 3IAKSsjPE7C4+KftkQmTfRI66055E/ED+pebbGWs0uJb4RD67i0Moc9SesvxifziFCfo csgdJRKa/VZoi2QXom3lMtHElg+dKZnCv5R9LAbynhcRFWdymkhTo57iPa7o+ri4s6yf DuH6fo1w5KRpFwknYUwmcWWUT6zy0gE9Y40nCUZpGRfzKqq5s+hsiT5/TBFIxAzcAPxo lq9VzlooTucPgsjhW4krDNm/9AeIup6+kKxzppUU+r2ZmrtYAZxM4Lx0pNTd79rTOk1H w2Kg== X-Gm-Message-State: AOJu0YwbNfD+BfRJ+Nsyc67UDB59XI+eAfWf3LJS3vJy224vIiyDN672 WV7K9BYUn62BTHnazPbuniiDFEwRLKY= X-Google-Smtp-Source: AGHT+IG5hzj+YaWYQmg1AYlWo66vhVSIEu0GaoqOemYSVrs8GuVJK+xs//uvpGVJ5sJobRGpBwcEbw== X-Received: by 2002:a05:600c:ad8:b0:3fb:9ef1:34ef with SMTP id c24-20020a05600c0ad800b003fb9ef134efmr463347wmr.37.1691122127991; Thu, 03 Aug 2023 21:08:47 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j6-20020adff006000000b00317b0155502sm1407143wro.8.2023.08.03.21.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 21:08:47 -0700 (PDT) Message-ID: <042271990895c4cfdedb20c3aed3d4141df610bd.1691122124.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 04 Aug 2023 04:08:44 +0000 Subject: [PATCH v2 3/3] docs: update when `git bisect visualize` uses `gitk` MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= This check has involved more environment variables than just `DISPLAY` since 508e84a790 (bisect view: check for MinGW32 and MacOSX in addition to X11, 2008-02-14), so let's update the documentation accordingly. Signed-off-by: Matthias Aßhauer --- Documentation/git-bisect.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt index fbb39fbdf5d..bec8d2abb22 100644 --- a/Documentation/git-bisect.txt +++ b/Documentation/git-bisect.txt @@ -204,9 +204,14 @@ as an alternative to `visualize`): $ git bisect visualize ------------ -If the `DISPLAY` environment variable is not set, 'git log' is used -instead. You can also give command-line options such as `-p` and -`--stat`. +Git detects a graphical environment through various environment variables: +`DISPLAY`, which is set in X Window System environments on Unix systems. +`SESSIONNAME`, which is set under Cygwin in interactive desktop sessions. +`MSYSTEM`, which is set under Msys2 and Git for Windows. +`SECURITYSESSIONID`, which is set on macOS in interactive desktop sessions. + +If none of these environment variables is set, 'git log' is used instead. +You can also give command-line options such as `-p` and `--stat`. ------------ $ git bisect visualize --stat