git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug report: git remote prune does not take negative refspecs into account
@ 2021-02-14  9:18 Christian Wolf
  0 siblings, 0 replies; only message in thread
From: Christian Wolf @ 2021-02-14  9:18 UTC (permalink / raw)
  To: git

Hello,

I found an issue with git and wanted to report this. Here is the filled result 
from `git bugreport` (sorry for the intermixed German, but I think the English 
statements should suffice to understand the issue).

Vielen Dank für das Ausfüllen eines Git-Fehlerberichts!
Bitte antworten Sie auf die folgenden Fragen, um uns dabei zu helfen, Ihr
Problem zu verstehen.

Was haben Sie gemacht, bevor der Fehler auftrat? (Schritte, um Ihr Fehler
zu reproduzieren)

1. I have configured a remote `upstream` with a refspec like `+refs/heads/
*:refs/upstream/heads/*`.
2. I have fetched remote `upstream` fetching two branches `foo` and `bar`.
3. I add another line to `.git/config` with a negative refspec
```
fetch = ^refs/heads/bar
```
4. I called `git fetch upstream` and `git remote prune upstream`.
5. Remove the refspec from step 2 in `.git/config` with some arbitrary names 
(e.g. `+refs/heads/baz:refs/upstream/heads/baz`), keep the negative refspec as 
it is
6. Fetch and prune (see step 4)
7. Undo step 5 and restore the original state as after step 3
8. Fetch and prune (see step 4)

Was haben Sie erwartet, was passieren soll? (Erwartetes Verhalten)
Expected behavior:

After the fetch in step 2 both branches are mirrored locally.

After the prune in line 4 the branch `bar` is dropped from the remotely 
fetched branches.

After step 6 both both remote branches `foo` and `bar` are no longer visible.
A possible error about unmatching branch `baz`.

After step 8 again a remote branch `foo` is existing.

Was ist stattdessen passiert? (Wirkliches Verhalten)
Real behavior:

After step 2: As intended

After step 4: Both remote branches are still visible. Nothing is pruned.

After step 6: Both remote branches are gone.

After step 8: Only `foo` is existing/fetched as remote branch.

Was ist der Unterschied zwischen dem, was Sie erwartet haben und was
wirklich passiert ist?
The difference of real and ideal behavior:

The difference is that after step 4 the remote branch `bar` is not pruned.

Sonstige Anmerkungen, die Sie hinzufügen möchten:

The steps 5~8 are there to verify the negative pathspec is working in general.
Fetching freshly takes the negativbe pathspec into account.

So the problem is within the pruning code.

[System Info]
git Version:
git version 2.30.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.10.10-arch1-1 #1 SMP PREEMPT Sat, 23 Jan 2021 23:59:48 +0000 
x86_64
Compiler Info: gnuc: 10.2
libc Info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/bash


[Aktivierte Hooks]

Thank you for looking into this.
Christian



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-14  9:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14  9:18 Bug report: git remote prune does not take negative refspecs into account Christian Wolf

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).