* [GSoC] [PATCH 0/1] t0001: replace "test [-d|-f]" with test_path_is_* functions @ 2022-01-21 10:21 Shaoxuan Yuan 2022-01-21 10:21 ` [GSoC] [PATCH 1/1] " Shaoxuan Yuan 0 siblings, 1 reply; 13+ messages in thread From: Shaoxuan Yuan @ 2022-01-21 10:21 UTC (permalink / raw) To: git; +Cc: Shaoxuan Yuan As a microproject, I found that the "test [-d|-f]" in t0001 test script can be replaced by appropriate helper functions. Shaoxuan Yuan (1): t0001-init.sh use test_path_is_* functions t/t0001-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-01-21 10:21 [GSoC] [PATCH 0/1] t0001: replace "test [-d|-f]" with test_path_is_* functions Shaoxuan Yuan @ 2022-01-21 10:21 ` Shaoxuan Yuan 2022-01-21 18:46 ` Taylor Blau 0 siblings, 1 reply; 13+ messages in thread From: Shaoxuan Yuan @ 2022-01-21 10:21 UTC (permalink / raw) To: git; +Cc: Shaoxuan Yuan Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> --- t/t0001-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 3235ab4d53..c72a28d3a5 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -6,7 +6,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh check_config () { - if test -d "$1" && test -f "$1/config" && test -d "$1/refs" + if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" then : happy else -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-01-21 10:21 ` [GSoC] [PATCH 1/1] " Shaoxuan Yuan @ 2022-01-21 18:46 ` Taylor Blau 2022-01-21 20:49 ` Junio C Hamano 0 siblings, 1 reply; 13+ messages in thread From: Taylor Blau @ 2022-01-21 18:46 UTC (permalink / raw) To: Shaoxuan Yuan; +Cc: git Hi Shaoxuan, On Fri, Jan 21, 2022 at 06:21:09PM +0800, Shaoxuan Yuan wrote: > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index 3235ab4d53..c72a28d3a5 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -6,7 +6,7 @@ TEST_PASSES_SANITIZE_LEAK=true > . ./test-lib.sh > > check_config () { > - if test -d "$1" && test -f "$1/config" && test -d "$1/refs" > + if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" > then > : happy > else Looks very reasonable to me. Indeed, this line comes from 6adcca3fe8 (Fix initialization of a bare repository, 2007-08-27) which predates 2caf20c52b (test-lib: user-friendly alternatives to test [-d|-f|-e], 2010-08-10) when these helpers were originally introduced. I thought that we could probably just shorten this to calling "test_path_is_file" twice: once for "$1/config" and a second time for "$1/refs", but that assumes "$1" is non-empty. And to ensure that you'd need another check, which amounts to the same amount of code overall. So the fix here looks good to me, and thanks for your contribution! Thanks, Taylor ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-01-21 18:46 ` Taylor Blau @ 2022-01-21 20:49 ` Junio C Hamano 2022-01-24 5:56 ` Shaoxuan Yuan 2022-02-10 3:11 ` Shaoxuan Yuan 0 siblings, 2 replies; 13+ messages in thread From: Junio C Hamano @ 2022-01-21 20:49 UTC (permalink / raw) To: Taylor Blau; +Cc: Shaoxuan Yuan, git Taylor Blau <me@ttaylorr.com> writes: >> - if test -d "$1" && test -f "$1/config" && test -d "$1/refs" >> + if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" >> then >> : happy >> else > > Looks very reasonable to me. Indeed, this line comes from 6adcca3fe8 > (Fix initialization of a bare repository, 2007-08-27) which predates > 2caf20c52b (test-lib: user-friendly alternatives to test [-d|-f|-e], > 2010-08-10) when these helpers were originally introduced. > > I thought that we could probably just shorten this to calling > "test_path_is_file" twice: once for "$1/config" and a second time for > "$1/refs", but that assumes "$1" is non-empty. And to ensure that you'd > need another check, which amounts to the same amount of code overall. I had the same thought. Since the first "$GIT_DIR must be a directory" matters only when the caller is crazy enough to have a bare repository at the root of the filesystem and to think that it is a good idea to say "" is the "$GIT_DIR" (in which case, "test -d ''" would fail, even though the tests for /config and /refs are checking the right thing), I do not see much downside from omitting the first one, but I think that is something we need to do _outside_ the topic of this change, which is purely "modernize, using the helpers we already have, without changing what we do". ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-01-21 20:49 ` Junio C Hamano @ 2022-01-24 5:56 ` Shaoxuan Yuan 2022-02-10 3:11 ` Shaoxuan Yuan 1 sibling, 0 replies; 13+ messages in thread From: Shaoxuan Yuan @ 2022-01-24 5:56 UTC (permalink / raw) To: Junio C Hamano; +Cc: Taylor Blau, git On Sat, Jan 22, 2022 at 4:49 AM Junio C Hamano <gitster@pobox.com> wrote: > > Taylor Blau <me@ttaylorr.com> writes: > > >> - if test -d "$1" && test -f "$1/config" && test -d "$1/refs" > >> + if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" > >> then > >> : happy > >> else > > > > Looks very reasonable to me. Indeed, this line comes from 6adcca3fe8 > > (Fix initialization of a bare repository, 2007-08-27) which predates > > 2caf20c52b (test-lib: user-friendly alternatives to test [-d|-f|-e], > > 2010-08-10) when these helpers were originally introduced. > > > > I thought that we could probably just shorten this to calling > > "test_path_is_file" twice: once for "$1/config" and a second time for > > "$1/refs", but that assumes "$1" is non-empty. And to ensure that you'd > > need another check, which amounts to the same amount of code overall. > > I had the same thought. > > Since the first "$GIT_DIR must be a directory" matters only when the > caller is crazy enough to have a bare repository at the root of the > filesystem and to think that it is a good idea to say "" is the > "$GIT_DIR" (in which case, "test -d ''" would fail, even though the > tests for /config and /refs are checking the right thing), I do not > see much downside from omitting the first one, but I think that is > something we need to do _outside_ the topic of this change, which is > purely "modernize, using the helpers we already have, without > changing what we do" > Yes I feel the same way, one patch for one thing :) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-01-21 20:49 ` Junio C Hamano 2022-01-24 5:56 ` Shaoxuan Yuan @ 2022-02-10 3:11 ` Shaoxuan Yuan 2022-02-10 7:12 ` Junio C Hamano 1 sibling, 1 reply; 13+ messages in thread From: Shaoxuan Yuan @ 2022-02-10 3:11 UTC (permalink / raw) To: Junio C Hamano; +Cc: Taylor Blau, git Hi Junio, Since I didn't see this change in seen or next, do you plan to apply it? -- Thanks, Shaoxuan On Sat, Jan 22, 2022 at 4:49 AM Junio C Hamano <gitster@pobox.com> wrote: > > Taylor Blau <me@ttaylorr.com> writes: > > >> - if test -d "$1" && test -f "$1/config" && test -d "$1/refs" > >> + if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" > >> then > >> : happy > >> else > > > > Looks very reasonable to me. Indeed, this line comes from 6adcca3fe8 > > (Fix initialization of a bare repository, 2007-08-27) which predates > > 2caf20c52b (test-lib: user-friendly alternatives to test [-d|-f|-e], > > 2010-08-10) when these helpers were originally introduced. > > > > I thought that we could probably just shorten this to calling > > "test_path_is_file" twice: once for "$1/config" and a second time for > > "$1/refs", but that assumes "$1" is non-empty. And to ensure that you'd > > need another check, which amounts to the same amount of code overall. > > I had the same thought. > > Since the first "$GIT_DIR must be a directory" matters only when the > caller is crazy enough to have a bare repository at the root of the > filesystem and to think that it is a good idea to say "" is the > "$GIT_DIR" (in which case, "test -d ''" would fail, even though the > tests for /config and /refs are checking the right thing), I do not > see much downside from omitting the first one, but I think that is > something we need to do _outside_ the topic of this change, which is > purely "modernize, using the helpers we already have, without > changing what we do". > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-10 3:11 ` Shaoxuan Yuan @ 2022-02-10 7:12 ` Junio C Hamano 2022-02-10 7:21 ` Shaoxuan Yuan 0 siblings, 1 reply; 13+ messages in thread From: Junio C Hamano @ 2022-02-10 7:12 UTC (permalink / raw) To: Shaoxuan Yuan; +Cc: Taylor Blau, git Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> writes: > Since I didn't see this change in seen or next, do you plan to apply it? I actually wasn't, as my understanding of it was primarily your practice. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-10 7:12 ` Junio C Hamano @ 2022-02-10 7:21 ` Shaoxuan Yuan 2022-02-10 17:23 ` Junio C Hamano 0 siblings, 1 reply; 13+ messages in thread From: Shaoxuan Yuan @ 2022-02-10 7:21 UTC (permalink / raw) To: Junio C Hamano; +Cc: Taylor Blau, git On Thu, Feb 10, 2022 at 3:12 PM Junio C Hamano <gitster@pobox.com> wrote: > > Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> writes: > > > Since I didn't see this change in seen or next, do you plan to apply it? > > I actually wasn't, as my understanding of it was primarily your > practice. Understood, thanks for the reply. -- Thanks, Shaoxuan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-10 7:21 ` Shaoxuan Yuan @ 2022-02-10 17:23 ` Junio C Hamano 2022-02-11 9:56 ` Shaoxuan Yuan 0 siblings, 1 reply; 13+ messages in thread From: Junio C Hamano @ 2022-02-10 17:23 UTC (permalink / raw) To: Shaoxuan Yuan; +Cc: Taylor Blau, git Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> writes: > On Thu, Feb 10, 2022 at 3:12 PM Junio C Hamano <gitster@pobox.com> wrote: >> >> Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> writes: >> >> > Since I didn't see this change in seen or next, do you plan to apply it? >> >> I actually wasn't, as my understanding of it was primarily your >> practice. > > Understood, thanks for the reply. FWIW, I have the posted patch plus the following SQUASH??? fix-up parked in the 'seen' branch. As the script is quiescent right now, I do not mind merging it down, now we spent more time on it ;-) t/t0001-init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index c72a28d3a5..d479303efa 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -6,7 +6,8 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh check_config () { - if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" + if test_path_is_dir "$1" && + test_path_is_file "$1/config" && test_path_is_dir "$1/refs" then : happy else -- 2.35.1-102-g2b9c120970 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-10 17:23 ` Junio C Hamano @ 2022-02-11 9:56 ` Shaoxuan Yuan 2022-02-11 16:53 ` Junio C Hamano 2022-02-14 8:45 ` Christian Couder 0 siblings, 2 replies; 13+ messages in thread From: Shaoxuan Yuan @ 2022-02-11 9:56 UTC (permalink / raw) To: Junio C Hamano; +Cc: Taylor Blau, git Hi Junio, On Fri, Feb 11, 2022 at 1:23 AM Junio C Hamano <gitster@pobox.com> wrote: > FWIW, I have the posted patch plus the following SQUASH??? fix-up I'm not so sure what does "SQUASH???" mean especially the three question marks, i.e. is it just an incidental text or a commit message convention? Is it for the convenience of grepping through the "git log" outputs (cause I found the commit 50d631c71c right away by grepping through the "git log" output)? > parked in the 'seen' branch. As the script is quiescent right now, > I do not mind merging it down, now we spent more time on it ;-) > > t/t0001-init.sh | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index c72a28d3a5..d479303efa 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -6,7 +6,8 @@ TEST_PASSES_SANITIZE_LEAK=true > . ./test-lib.sh > > check_config () { > - if test_path_is_dir "$1" && test_path_is_file "$1/config" && test_path_is_dir "$1/refs" > + if test_path_is_dir "$1" && > + test_path_is_file "$1/config" && test_path_is_dir "$1/refs" > then > : happy > else Yeah, I think wrapping it around is a good idea :-) > -- > 2.35.1-102-g2b9c120970 > -- Thanks & Regards, Shaoxuan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-11 9:56 ` Shaoxuan Yuan @ 2022-02-11 16:53 ` Junio C Hamano 2022-02-14 8:45 ` Christian Couder 1 sibling, 0 replies; 13+ messages in thread From: Junio C Hamano @ 2022-02-11 16:53 UTC (permalink / raw) To: Shaoxuan Yuan; +Cc: Taylor Blau, git Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> writes: > On Fri, Feb 11, 2022 at 1:23 AM Junio C Hamano <gitster@pobox.com> wrote: >> FWIW, I have the posted patch plus the following SQUASH??? fix-up > > I'm not so sure what does "SQUASH???" mean especially the three > question marks, i.e. is it just an incidental text or a commit message > convention? > Is it for the convenience of grepping through the > "git log" outputs (cause I found the commit 50d631c71c right away by > grepping through the "git log" output)? It is primarily to remind me not to merge the branch down to 'next' without dealing with it. > Yeah, I think wrapping it around is a good idea :-) Then will squash it in and merge it down. Thanks. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-11 9:56 ` Shaoxuan Yuan 2022-02-11 16:53 ` Junio C Hamano @ 2022-02-14 8:45 ` Christian Couder 2022-02-14 8:53 ` Shaoxuan Yuan 1 sibling, 1 reply; 13+ messages in thread From: Christian Couder @ 2022-02-14 8:45 UTC (permalink / raw) To: Shaoxuan Yuan; +Cc: Junio C Hamano, Taylor Blau, git On Mon, Feb 14, 2022 at 9:32 AM Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> wrote: > On Fri, Feb 11, 2022 at 1:23 AM Junio C Hamano <gitster@pobox.com> wrote: > > FWIW, I have the posted patch plus the following SQUASH??? fix-up > > I'm not so sure what does "SQUASH???" mean especially the three > question marks, i.e. is it just an incidental text or a commit message > convention? It means that you might want to squash the fix-up commit or a similar commit into your commit (or one of your commits in case of a commit/patch series), and then resubmit a new version. > Is it for the convenience of grepping through the > "git log" outputs (cause I found the commit 50d631c71c right away by > grepping through the "git log" output)? It is for convenience that it's named "SQUASH???" as everyone (who is familiar with the mailing list) then knows what needs to be done on the proposed commit(s). > > parked in the 'seen' branch. As the script is quiescent right now, > > I do not mind merging it down, now we spent more time on it ;-) Alternatively as Junio says he is ok with merging that down, you might just accept his offer and he will squash the "SQUASH???" commit for you before merging the result into the "next" branch. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GSoC] [PATCH 1/1] t0001: replace "test [-d|-f]" with test_path_is_* functions 2022-02-14 8:45 ` Christian Couder @ 2022-02-14 8:53 ` Shaoxuan Yuan 0 siblings, 0 replies; 13+ messages in thread From: Shaoxuan Yuan @ 2022-02-14 8:53 UTC (permalink / raw) To: Christian Couder; +Cc: Junio C Hamano, Taylor Blau, git On Mon, Feb 14, 2022 at 4:45 PM Christian Couder <christian.couder@gmail.com> wrote: > > On Mon, Feb 14, 2022 at 9:32 AM Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> wrote: > > On Fri, Feb 11, 2022 at 1:23 AM Junio C Hamano <gitster@pobox.com> wrote: > > > FWIW, I have the posted patch plus the following SQUASH??? fix-up > > > > I'm not so sure what does "SQUASH???" mean especially the three > > question marks, i.e. is it just an incidental text or a commit message > > convention? > > It means that you might want to squash the fix-up commit or a similar > commit into your commit (or one of your commits in case of a > commit/patch series), and then resubmit a new version. > > > Is it for the convenience of grepping through the > > "git log" outputs (cause I found the commit 50d631c71c right away by > > grepping through the "git log" output)? > > It is for convenience that it's named "SQUASH???" as everyone (who is > familiar with the mailing list) then knows what needs to be done on > the proposed commit(s). Yeah, now I see :) > > > parked in the 'seen' branch. As the script is quiescent right now, > > > I do not mind merging it down, now we spent more time on it ;-) > > Alternatively as Junio says he is ok with merging that down, you might > just accept his offer and he will squash the "SQUASH???" commit for > you before merging the result into the "next" branch. Yeah, I saw the squashed version in the latest "What's cooking in git.git". Thanks for the help and suggestions :) -- Thanks & Regards, Shaoxuan ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-02-14 8:53 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-21 10:21 [GSoC] [PATCH 0/1] t0001: replace "test [-d|-f]" with test_path_is_* functions Shaoxuan Yuan 2022-01-21 10:21 ` [GSoC] [PATCH 1/1] " Shaoxuan Yuan 2022-01-21 18:46 ` Taylor Blau 2022-01-21 20:49 ` Junio C Hamano 2022-01-24 5:56 ` Shaoxuan Yuan 2022-02-10 3:11 ` Shaoxuan Yuan 2022-02-10 7:12 ` Junio C Hamano 2022-02-10 7:21 ` Shaoxuan Yuan 2022-02-10 17:23 ` Junio C Hamano 2022-02-11 9:56 ` Shaoxuan Yuan 2022-02-11 16:53 ` Junio C Hamano 2022-02-14 8:45 ` Christian Couder 2022-02-14 8:53 ` Shaoxuan Yuan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.