* [PATCH] bisect: remove root directory restriction for git bisect @ 2020-03-22 9:15 Sheikh hamza via GitGitGadget 2020-03-22 10:48 ` SZEDER Gábor 0 siblings, 1 reply; 7+ messages in thread From: Sheikh hamza via GitGitGadget @ 2020-03-22 9:15 UTC (permalink / raw) To: git; +Cc: Sheikh hamza, sheikh hamza From: sheikh hamza <sheikhhamza012@gmail.com> 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 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 9:15 [PATCH] bisect: remove root directory restriction for git bisect Sheikh hamza via GitGitGadget @ 2020-03-22 10:48 ` SZEDER Gábor 2020-03-22 14:30 ` sheikh hamza ` (4 more replies) 0 siblings, 5 replies; 7+ messages in thread From: SZEDER Gábor @ 2020-03-22 10:48 UTC (permalink / raw) To: Sheikh hamza via GitGitGadget; +Cc: git, Sheikh hamza 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? > 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. > > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 10:48 ` SZEDER Gábor @ 2020-03-22 14:30 ` sheikh hamza 2020-03-22 14:39 ` sheikh hamza ` (3 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: sheikh hamza @ 2020-03-22 14:30 UTC (permalink / raw) To: szeder.dev; +Cc: git, gitgitgadget, sheikhhamza012 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 10:48 ` SZEDER Gábor 2020-03-22 14:30 ` sheikh hamza @ 2020-03-22 14:39 ` sheikh hamza 2020-03-22 14:58 ` sheikh hamza ` (2 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: sheikh hamza @ 2020-03-22 14:39 UTC (permalink / raw) To: sheikhhamza012; +Cc: git, gitgitgadget ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 10:48 ` SZEDER Gábor 2020-03-22 14:30 ` sheikh hamza 2020-03-22 14:39 ` sheikh hamza @ 2020-03-22 14:58 ` sheikh hamza 2020-03-23 16:02 ` Johannes Schindelin 2020-03-23 16:17 ` Junio C Hamano 4 siblings, 0 replies; 7+ messages in thread From: sheikh hamza @ 2020-03-22 14:58 UTC (permalink / raw) To: szeder.dev; +Cc: git, gitgitgadget, sheikhhamza012 i apologize for empty mails, i was configuring the mailer, by the issue i meant one of those mentioned on gigitgadget's fork, there this was mentioned as a good entry point project so thought of doing it as my GSoC microproject, do you think it makes a good microproject should i continue to work on it ? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 10:48 ` SZEDER Gábor ` (2 preceding siblings ...) 2020-03-22 14:58 ` sheikh hamza @ 2020-03-23 16:02 ` Johannes Schindelin 2020-03-23 16:17 ` Junio C Hamano 4 siblings, 0 replies; 7+ messages in thread From: Johannes Schindelin @ 2020-03-23 16:02 UTC (permalink / raw) To: SZEDER Gábor; +Cc: Sheikh hamza via GitGitGadget, git, Sheikh hamza [-- Attachment #1: Type: text/plain, Size: 1664 bytes --] Hi Gábor, On Sun, 22 Mar 2020, SZEDER Gábor wrote: > On Sun, Mar 22, 2020 at 09:15:47AM +0000, Sheikh hamza via GitGitGadget wrote: > > From: sheikh hamza <sheikhhamza012@gmail.com> > > > > 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)? Because other commands also allow the user to run in a subdirectory. For example, `git rebase`, `git checkout`, `git cherry-pick`, etc > 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? The same that happens if that situation arises in `git rebase` or `git checkout`: the directory is removed unless it is not empty (i.e. if there are untracked files in the directory, or submodules). > 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? On Windows, the directory is not deletable, of course, and the same thing happens as if an untracked file is still in that directory: it is not deleted. > > git-bisect.sh | 1 + > > t/perf/bisect_regression | 6 ++---- > > 2 files changed, 3 insertions(+), 4 deletions(-) The most obvious problem with this patch is that it is not accompanied by a regression test that documents and verifies the intended behavior. Ciao, Dscho ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bisect: remove root directory restriction for git bisect 2020-03-22 10:48 ` SZEDER Gábor ` (3 preceding siblings ...) 2020-03-23 16:02 ` Johannes Schindelin @ 2020-03-23 16:17 ` Junio C Hamano 4 siblings, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2020-03-23 16:17 UTC (permalink / raw) To: SZEDER Gábor; +Cc: Sheikh hamza via GitGitGadget, git, Sheikh hamza SZEDER Gábor <szeder.dev@gmail.com> writes: > 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? Hmm, I am of two minds. Most certainly, the bisection would break when the directory cannot be removed, and if it can be, then $pwd would become in a weird state and the iteration with the bisect machinery (be it interactive test before saying "bisect good/bad", or the command execution during "bisect run") would fail in a strange and unpredictable ways. So from that perspective, it does make sense to forbid running "git bisect" from a subdirectory, and we should probably do so on the same principle for "git checkout", "git pull" and many other things. But even then, it would not probably be foolproof. Another process that the end-user is not even aware of its execution (e.g. virus scanners?) may have a file open in the subdirectory on a filesystem that does not allow directories to be removed while there is an open file descriptor on a file it contains, and would cause the command to fail in a similar way. So it probably is being too draconian to forbid these commands (not just "git bisect") from being run in a subdirectory for no good reason (i.e. being strict is not helping us much). What would help is to make sure we fail in an understandable way (i.e. "cannot remove directory /foo/bar/boz, so checkout of version v1.2.3 failed" is clearly conveyed to the end user, which we may be already doing in which case that is wonderful). >> 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. This is a good point. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-23 16:18 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-03-22 9:15 [PATCH] bisect: remove root directory restriction for git bisect Sheikh hamza via GitGitGadget 2020-03-22 10:48 ` SZEDER Gábor 2020-03-22 14:30 ` sheikh hamza 2020-03-22 14:39 ` sheikh hamza 2020-03-22 14:58 ` sheikh hamza 2020-03-23 16:02 ` Johannes Schindelin 2020-03-23 16:17 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).