git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] bisect: remove root directory restriction for git bisect

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Mar 22, 2020, 10:48 UTC
Message-ID
<20200322104826.GB2224@szeder.dev>
In-Reply-To
<pull.736.git.git.1584868547682.gitgitgadget@gmail.com>
On Sun, Mar 22, 2020 at 09:15:47AM +0000, Sheikh hamza via GitGitGadget wrote:
> From: sheikh hamza <sheikhhamza012@gmail.com>
> 
>     according to the open issue #486
What issue #486?  Where?  The Git project doesn't use issues.
> the git bisect
>     command should be able to run from inside any
>     subdirectory

Why should 'git bisect' be able to run from inside any subdirectory (of the working tree, I presume)?

In particular, what happens, if someone starts 'git bisect' from within 'subdir/', and 'git bisect' then checks out an old commit, where said 'subdir/' didn't exist? What happens, if the user runs 'git bisect run ./script' from within 'subdir/', and that 'subdir/' doesn't exist in that old commit? What happens, if 'subdir' does exists in that old commit, but it's a file, not a directory? What happens, if all this is on Windows?

Show 9 quoted lines
> and in the same disscusion "dscho"
>     gave the directions and those directions lead me
>     the fix of adding SUBDIRECTORY_OK=Yes on L#34
>     before sourcing git-sh-setup that made it work as
>     in git-sh-setup there was a check on SUBDIRECTORY_OK
>     that prevents it to run in sub directories if it is not
>     set to "ok" as this file was also sourced in other commands
>     that are required to only run from root one of such scripts
>     is git-filter-branch

Please don't indent the commit message and use punctuation to make it more readable.

Show 59 quoted lines
> 
> Signed-off-by: sheikh hamza <sheikhhamza012@gmail.com>
> ---
>     bisect: remove root directory restriction for git bisect
>     
>     according to the open issue #486 the git bisect
>     command should be able to run from inside any
>     subdirectory and in the same disscusion "dscho"
>     gave the directions and those directions lead me
>     the fix of adding SUBDIRECTORY_OK=Yes on L#34
>     before sourcing git-sh-setup that made it work as
>     in git-sh-setup there was a check on SUBDIRECTORY_OK
>     that prevents it to run in sub directories if it is not
>     set to "ok" as this file was also sourced in other commands
>     that are required to only run from root one of such scripts
>     is git-filter-branch
> 
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-736%2Fsheikhhamza012%2Fbisect_subdirectory_fix-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-736/sheikhhamza012/bisect_subdirectory_fix-v1
> Pull-Request: https://github.com/git/git/pull/736
> 
>  git-bisect.sh            | 1 +
>  t/perf/bisect_regression | 6 ++----
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/git-bisect.sh b/git-bisect.sh
> index efee12b8b1e..8c1da200e41 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -31,6 +31,7 @@ git bisect run <cmd>...
>  
>  Please use "git help bisect" to get the full man page.'
>  
> +SUBDIRECTORY_OK=Yes
>  OPTIONS_SPEC=
>  . git-sh-setup
>  
> diff --git a/t/perf/bisect_regression b/t/perf/bisect_regression
> index ce47e1662a9..d6b96f49e46 100755
> --- a/t/perf/bisect_regression
> +++ b/t/perf/bisect_regression
> @@ -57,11 +57,9 @@ tmpdir=$(mktemp -d -t bisect_regression_XXXXXX) || die "Failed to create temp di
>  echo "$oldtime" >"$tmpdir/oldtime" || die "Failed to write to '$tmpdir/oldtime'"
>  echo "$newtime" >"$tmpdir/newtime" || die "Failed to write to '$tmpdir/newtime'"
>  
> -# Bisecting must be performed from the top level directory (even with --no-checkout)
> -(
> -	toplevel_dir=$(git rev-parse --show-toplevel) || die "Failed to find top level directory"
> -	cd "$toplevel_dir" || die "Failed to cd into top level directory '$toplevel_dir'"
>  
> +(
> +	 
>  	git bisect start --no-checkout "$newrev" "$oldrev" || die "Failed to start bisecting"
>  
>  	git bisect run t/perf/bisect_run_script "$test_script" "$test_number" "$tmpdir"
> 
> base-commit: 98cedd0233ee88e69711f79d1126b6bd772ff5bd
> -- 
> gitgitgadget
Previous: Sheikh hamza via GitGitGadgetNext: sheikh hamza
Message 2 of 7 in “bisect: remove root directory restriction for git bisect”
  1. bisect: remove root directory restriction for git bisectSheikh hamza via GitGitGadget, Mar 22, 2020
  2. SZEDER GáborMar 22, 2020
  3. sheikh hamzaMar 22, 2020
  4. sheikh hamzaMar 22, 2020
  5. sheikh hamzaMar 22, 2020
  6. Johannes SchindelinMar 23, 2020
  7. Junio C HamanoMar 23, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.