# [PATCH] t9104: kosherly remove remote refs

4 messages from 2018-06-01 to 2018-06-02. Participants: Christian Couder, Johannes Schindelin, Michael Haggerty, SZEDER Gábor.
Thread: https://gitlist.dev/t/48620

## Christian Couder, 2018-06-01 05:08

Subject: [PATCH] t9104: kosherly remove remote refs
Message-ID: <20180601050833.27676-1-chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20180601050833.27676-1-chriscool%40tuxfamily.org

```
As there are plans to implement other ref storage systems,
let's use a way to remove remote refs that does not depend
on refs being files.

This makes it clear to readers that this test does not
depend on which ref backend is used.

Suggested-by: Michael Haggerty <mhagger@alum.mit.edu>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
This was suggested and discussed in:

https://public-inbox.org/git/20180525085906.GA2948@sigill.intra.peff.net/

 t/t9104-git-svn-follow-parent.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 9c49b6c1fe..5e0ad19177 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -215,7 +215,9 @@ test_expect_success "multi-fetch continues to work" "
 	"
 
 test_expect_success "multi-fetch works off a 'clean' repository" '
-	rm -rf "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" &&
+	rm -rf "$GIT_DIR/svn" &&
+	git for-each-ref --format="option no-deref%0adelete %(refname)" refs/remotes |
+	git update-ref --stdin &&
 	git reflog expire --all --expire=all &&
 	mkdir "$GIT_DIR/svn" &&
 	git svn multi-fetch
-- 
2.17.0.1035.g12039e008f


```

## Johannes Schindelin, 2018-06-01 11:25

Subject: Re: [PATCH] t9104: kosherly remove remote refs
Message-ID: <nycvar.QRO.7.76.6.1806011324530.77@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1806011324530.77%40tvgsbejvaqbjf.bet
In-Reply-To: <20180601050833.27676-1-chriscool@tuxfamily.org>

```
Hi Chris,

On Fri, 1 Jun 2018, Christian Couder wrote:

> As there are plans to implement other ref storage systems,
> let's use a way to remove remote refs that does not depend
> on refs being files.
> 
> This makes it clear to readers that this test does not
> depend on which ref backend is used.
> 
> Suggested-by: Michael Haggerty <mhagger@alum.mit.edu>
> Helped-by: Jeff King <peff@peff.net>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> This was suggested and discussed in:
> 
> https://public-inbox.org/git/20180525085906.GA2948@sigill.intra.peff.net/
> 
>  t/t9104-git-svn-follow-parent.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
> index 9c49b6c1fe..5e0ad19177 100755
> --- a/t/t9104-git-svn-follow-parent.sh
> +++ b/t/t9104-git-svn-follow-parent.sh
> @@ -215,7 +215,9 @@ test_expect_success "multi-fetch continues to work" "
>  	"
>  
>  test_expect_success "multi-fetch works off a 'clean' repository" '
> -	rm -rf "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" &&
> +	rm -rf "$GIT_DIR/svn" &&
> +	git for-each-ref --format="option no-deref%0adelete %(refname)" refs/remotes |
> +	git update-ref --stdin &&

Apart from the line longer than our conventions allow, this looks fine to
me!

>  	git reflog expire --all --expire=all &&
>  	mkdir "$GIT_DIR/svn" &&
>  	git svn multi-fetch
> -- 
> 2.17.0.1035.g12039e008f

Please upgrade ;-)

Ciao,
Dscho

```

## Michael Haggerty, 2018-06-02 09:43

Subject: Re: [PATCH] t9104: kosherly remove remote refs
Message-ID: <CAMy9T_Edbrd-90=Zrp_3bSyuT8GhEu9228_iiaGzwLwAVDn40w@mail.gmail.com>
URL: https://gitlist.dev/e/CAMy9T_Edbrd-90%3DZrp_3bSyuT8GhEu9228_iiaGzwLwAVDn40w%40mail.gmail.com
In-Reply-To: <20180601050833.27676-1-chriscool@tuxfamily.org>

```
On Fri, Jun 1, 2018 at 7:08 AM, Christian Couder
<christian.couder@gmail.com> wrote:
> As there are plans to implement other ref storage systems,
> let's use a way to remove remote refs that does not depend
> on refs being files.
>
> This makes it clear to readers that this test does not
> depend on which ref backend is used.
>
> Suggested-by: Michael Haggerty <mhagger@alum.mit.edu>
> Helped-by: Jeff King <peff@peff.net>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> This was suggested and discussed in:
>
> https://public-inbox.org/git/20180525085906.GA2948@sigill.intra.peff.net/
>
>  t/t9104-git-svn-follow-parent.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
> index 9c49b6c1fe..5e0ad19177 100755
> --- a/t/t9104-git-svn-follow-parent.sh
> +++ b/t/t9104-git-svn-follow-parent.sh
> @@ -215,7 +215,9 @@ test_expect_success "multi-fetch continues to work" "
>         "
>
>  test_expect_success "multi-fetch works off a 'clean' repository" '
> -       rm -rf "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" &&
> +       rm -rf "$GIT_DIR/svn" &&
> +       git for-each-ref --format="option no-deref%0adelete %(refname)" refs/remotes |
> +       git update-ref --stdin &&
>         git reflog expire --all --expire=all &&
>         mkdir "$GIT_DIR/svn" &&
>         git svn multi-fetch
> --
> 2.17.0.1035.g12039e008f

+1 LGTM.

Michael

```

## SZEDER Gábor, 2018-06-02 12:28

Subject: Re: [PATCH] t9104: kosherly remove remote refs
Message-ID: <CAM0VKj=YgNAb_-BfhBJNjYScfUCnU9Vp_Upy7jtyBisYXzg8Ng@mail.gmail.com>
URL: https://gitlist.dev/e/CAM0VKj%3DYgNAb_-BfhBJNjYScfUCnU9Vp_Upy7jtyBisYXzg8Ng%40mail.gmail.com
In-Reply-To: <20180601050833.27676-1-chriscool@tuxfamily.org>

```
On Fri, Jun 1, 2018 at 7:08 AM, Christian Couder
<christian.couder@gmail.com> wrote:
>  test_expect_success "multi-fetch works off a 'clean' repository" '
> -       rm -rf "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" &&
> +       rm -rf "$GIT_DIR/svn" &&
> +       git for-each-ref --format="option no-deref%0adelete %(refname)" refs/remotes |
> +       git update-ref --stdin &&

Is that "option no-deref" really necessary when deleting refs?  Does
it have any effect at all?

The synopsis in 'git update-ref's manpage indicates that '--no-deref'
is only applicable when updating a ref, but not when deleting one;
though the usage shown by 'git update-ref -h' doesn't indicate this.
Anyway, it appears that when deleting refs no symref dereferencing is
performed and '--no-deref' is simply ignored:

  $ git branch one
  $ git branch two
  $ git symbolic-ref ONE refs/heads/one
  $ git symbolic-ref TWO refs/heads/two
  $ cat .git/{ONE,TWO}
  ref: refs/heads/one
  ref: refs/heads/two
  $ git update-ref -d ONE
  $ git update-ref --no-deref -d TWO
  $ cat .git/{ONE,TWO}
  cat: .git/ONE: No such file or directory
  cat: .git/TWO: No such file or directory
  $ git for-each-ref
  95c5b8654fd75df13ed29f43cff52287414c3877 commit       refs/heads/master
  95c5b8654fd75df13ed29f43cff52287414c3877 commit       refs/heads/one
  95c5b8654fd75df13ed29f43cff52287414c3877 commit       refs/heads/two

```
